mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-05 02:09:26 +02:00
youtube upload is now working
This commit is contained in:
parent
0347a52e29
commit
c634582177
1 changed files with 8 additions and 3 deletions
|
@ -38,8 +38,6 @@ SCOPES = ['https://www.googleapis.com/auth/youtube.upload']
|
||||||
API_SERVICE_NAME = 'youtube'
|
API_SERVICE_NAME = 'youtube'
|
||||||
API_VERSION = 'v3'
|
API_VERSION = 'v3'
|
||||||
|
|
||||||
VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted')
|
|
||||||
|
|
||||||
|
|
||||||
# Authorize the request and store authorization credentials.
|
# Authorize the request and store authorization credentials.
|
||||||
def get_authenticated_service():
|
def get_authenticated_service():
|
||||||
|
@ -54,7 +52,7 @@ def initialize_upload(youtube, options):
|
||||||
|
|
||||||
body=dict(
|
body=dict(
|
||||||
snippet=dict(
|
snippet=dict(
|
||||||
title=options.title,
|
name=options.name,
|
||||||
description=options.description,
|
description=options.description,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
categoryId=options.category
|
categoryId=options.category
|
||||||
|
@ -108,3 +106,10 @@ def resumable_upload(request):
|
||||||
print 'Sleeping %f seconds and then retrying...' % sleep_seconds
|
print 'Sleeping %f seconds and then retrying...' % sleep_seconds
|
||||||
time.sleep(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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue