WHAT I'M DOING:
Uploading youtube videos using Youtube's Upload API. However, I'm getting the following error:
Exception has occurred: TimeoutError
The write operation timed out
at the *** line in my code:
def uploadToYoutube(title, description, tags, videoFilename, thumbnailFilename, number, date):
chdir(r'C:\Users\jack_l\Documents\client')
CLIENT_SECRET_FILE = 'client_secret.json'
API_NAME = 'youtube'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/youtube.upload']
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
upload_date_time = datetime.datetime(date[0], date[1], date[2], date[3], 0, 0).isoformat() + '.000Z'
request_body = {
'snippet': {
'categoryI': 24,
'title': title,
'description': description,
'tags': tags
},
'status': {
'privacyStatus': 'private',
'publishAt': upload_date_time,
'selfDeclaredMadeForKids': False,
},
'notifySubscribers': False
}
mediaFile = MediaFileUpload(videoFilename)
response_upload = service.videos().insert(
part='snippet,status',
body=request_body,
media_body=mediaFile
*** ).execute()
chdir(r'C:\Users\samlb\Documents\REDDIT_TO_YOUTUBE_PYTHON_SELENIUM\redditVideo\thumbnails')
service.thumbnails().set(
videoId=response_upload.get('id'),
media_body=MediaFileUpload(thumbnailFilename)
).execute()
WHAT I KNOW:
- My program works with smaller, shorter videos. The program timesout (the error shown above to be exact) when trying to upload larger videos.
I'm really confused so any help would be greatly appreciated, thank you.