我之前问过几乎相同的问题,但由于在尝试解决该问题时出现了一个新错误而未能得到解决方案,该错误掩盖了最初的错误。问题是,当我尝试使用下面的代码上传 YouTube 视频时,我在标题中收到错误(完整跟踪如下),但无法执行此操作。我对导致错误的原因一无所知,并希望得到任何帮助。
def upload(beatName, mainArtist, keywords, oneLiner):
CLIENT_SECRET_FILE = 'client_secret.json'
API_NAME = 'youtube'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/youtube']
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
upload_date_time = DT.datetime(2020, 9, 3, 12, 30, 0).isoformat() + '.000Z'
title = "OTOROSHI - "test"
description = 'Test'
request_body = {
'snippet': {
'categoryI': 10,
'title': title,
'description': description,
'tags': keywords
},
'status': {
'privacyStatus': 'private',
'publishAt': upload_date_time,
'selfDeclaredMadeForKids': False,
},
'notifySubscribers': True
}
mediaFile = MediaFileUpload('E:\Everything.mp4')
response_upload = service.videos().insert(
part = 'snippet,status',
body = request_body,
media_body = mediaFile
).execute()
相关分类