我在使用 YouTube API3 时不断收到此错误
上传视频时出错:
GoogleJsonResponseException: API call to youtube.videos.insert failed with error: The request cannot be completed because you have exceeded your \<a href="/youtube/v3/getting-started#quota"\>quota\</a\>
而且我不知道在哪里看。
我基本上会选择电子表格上写下的每个 FileID,将它们上传到 YouTube,然后打印我刚刚上传的视频 ID。 我可以上传大约三个视频,然后就会出现警告标志,说我已达到配额。
我尝试查看谷歌控制台,但似乎还没有达到。不确定我是否在正确的地方寻找。如何查看我正在使用的配额量以及如何增加配额?
// This is the basic idea
//I get the information to upload the video on youtube
def upload_video(video_file, channel_id, youtube_object):
try:
# Define the video metadata
request_body = {
'snippet': {
'title': 'TESTING BY ME',
'description': 'Your video description',
'tags': ['tag1', 'tag2', 'tag3'],
'categoryId': '22', # Set the appropriate category ID
'channelId': channel_id # Set the channel ID
},
'status': {
'privacyStatus': 'private' # Set the privacy status of the video
}
}
# Create a media upload object for the video file
media = MediaFileUpload(video_file)
# Execute the video insert request
response = youtube_object.videos().insert(
part='snippet,status',
body=request_body,
media_body=media
).execute()
# Print the video ID of the uploaded video
print('Video uploaded. Video ID:', response['id'])
// And after uploading, I get the title and video id for every video
console.log(`Video ID (${videoId}) and Title (${videoTitle}) written to sheet.`);
我有大量视频要上传到 YouTube,它们都很短(不到一分钟),我尝试使用 API 来帮助我完成此任务,但我只能使用该脚本上传三个视频。
上传需要1600个报价点,如果您仍在使用10k配额点的开发报价,您将无法在一天内上传很多视频。
美国西海岸午夜配额重置
一旦您的申请确实用于生产,您应该申请增加配额