From c63458217736b716c5dd1181288c04392ec27437 Mon Sep 17 00:00:00 2001 From: LecygneNoir Date: Fri, 2 Mar 2018 10:09:01 +0100 Subject: [PATCH] youtube upload is now working --- lib/yt_upload.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/yt_upload.py b/lib/yt_upload.py index 15c0978..57cb50f 100644 --- a/lib/yt_upload.py +++ b/lib/yt_upload.py @@ -38,8 +38,6 @@ SCOPES = ['https://www.googleapis.com/auth/youtube.upload'] API_SERVICE_NAME = 'youtube' API_VERSION = 'v3' -VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted') - # Authorize the request and store authorization credentials. def get_authenticated_service(): @@ -54,7 +52,7 @@ def initialize_upload(youtube, options): body=dict( snippet=dict( - title=options.title, + name=options.name, description=options.description, tags=tags, categoryId=options.category @@ -108,3 +106,10 @@ def resumable_upload(request): print 'Sleeping %f seconds and then retrying...' % sleep_seconds time.sleep(sleep_seconds) + +def run(options): + youtube = get_authenticated_service() + try: + initialize_upload(youtube, options) + except HttpError, e: + print 'An HTTP error %d occurred:\n%s' % (e.resp.status, e.content)