Gpodder 无法下载 TED 演讲字幕

Gpodder 无法下载 TED 演讲字幕

我尝试在 Gpodder 中下载带字幕的 TED 演讲,但没有成功。

我使用 Ubuntu 14.04 和 gpodder 3.5.2。我在 TED HD 演讲中进行了测试订阅(http://feeds.feedburner.com/TedtalksHD/) 和定期会谈 (http://feeds.feedburner.com/tedtalks_video)。它适用于视频,但无需下载字幕。

在工具-首选项-扩展中,TED Talks 字幕下载器处于活动状态。

我怎样才能让它工作?

答案1

看起来 TED 演讲字幕下载器目前已损坏,以下是我在终端中得到的结果:

1399579128.331572 [gpodder.download] INFO: Download was redirected (http://video.ted.com/talk/podcast/2014/None/TEDMusical_2014-480p.mp4). New filename: TEDMusical_2014-480p.mp4
1399579128.336851 [ted_subtitles] INFO: subtitle url: http://www.ted.com/talks/subtitles/id/1962/lang/eng
1399579128.996226 [gpodder.gtkui.main] INFO: All tasks have finished.
1399579129.035496 [gpodder.gtkui.main] INFO: All tasks have finished.
1399579129.099886 [ted_subtitles] INFO: episode url: http://feedproxy.google.com/~r/TedtalksHD/~3/DKXNGZwfYwo/daffodil_hudson_is_this_the_cure_for_stage_fright
1399579130.692832 [gpodder.extensions] ERROR: Error in /usr/share/gpodder/extensions/ted_subtitles.py in on_episode_downloaded: list index out of range
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/gpodder/extensions.py", line 83, in handler
    cb_res = callback(*args, **kwargs)
  File "/usr/share/gpodder/extensions/ted_subtitles.py", line 92, in on_episode_downloaded
    intro = episode_data.split('introDuration%22%3A')[1] \
IndexError: list index out of range

但它是 Python,可以轻松修复!

据我所见,TED描述页面格式发生了改变。

要解决这个问题:

  • 替换'introDuration%22%3A''introDuration":'
  • '%2C'用。。。来代替','

/usr/share/gpodder/extensions/ted_subtitles.py

即从第 89 行开始此代码:

    INTRO_DEFAULT = 15
    try:
        # intro in the data could be 15 or 15.33
        intro = episode_data.split('introDuration%22%3A')[1] \
                            .split('%2C')[0] or INTRO_DEFAULT

应该变成:

    INTRO_DEFAULT = 15
    try:
        # intro in the data could be 15 or 15.33
        intro = episode_data.split('introDuration":')[1] \
                            .split(',')[0] or INTRO_DEFAULT

此后,字幕应下载到与下载的视频相同的目录中(与视频相同,但带有.srt扩展名)。

在 Ubuntu 14.04 上使用 gPodder 3.5.2 进行测试。

编辑:我向 gPodder 发出了修复请求:https://github.com/gpodder/gpodder/pull/121

相关内容