YouTube API v3 - 字幕上传会导致HTTP 500后端错误

时间:2015-07-22 17:07:18

标签: python youtube-data-api

我正在使用代码示例来了解如何使用YouTube v3 API方法上传YouTube视频字幕轨道,具体位置如下:

https://developers.google.com/youtube/v3/code_samples/python#create_and_manage_youtube_video_caption_tracks

但是,当我使用以下命令从命令行运行它时:

python manage_captions.py --file="test.srt" --videoid='dDiL1fbAIdA' --action='upload'

test.rst的内容是:

First line of caption track: 1
00:00:23,000 --> 00:00:25,000
This text displays for two seconds starting
1 minute and 23 seconds into the video.

2
00:02:20,250 --> 00:02:23,800
This text displays from 2 minutes and 20.25 seconds after the start
of the video until 2 minutes and 23.8 seconds after the start of the video.

3
00:03:14,159 --> 00:03:22,092
This text displays beginning 3 minutes and 14.159 seconds
after the start of the video for an undefined length of time. 

我收到HTTP错误:

An HTTP error 500 occurred:
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "backendError",
    "message": "Backend Error"
   }
  ],
  "code": 500,
  "message": "Backend Error"
 }
}

为什么会发生这种情况的任何想法?

2 个答案:

答案 0 :(得分:0)

您需要在调用中添加--language ='en',因为它是必填字段。

答案 1 :(得分:0)

今天再次尝试后,我能够成功上传字幕。不知道发生了什么变化,但错误没有重复,尽管我没有改变任何事情。