从YouTube视频中提取自动字幕 [英] Extract automatic captions from YouTube video

查看:3022
本文介绍了从YouTube视频中提取自动字幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从YouTube视频提取自动字幕时遇到问题.

I'm having problems extracting automatic captions from YouTube videos.

我尝试使用> http://video.google.com/timedtext?type=track&v=3wszM2SA12E&name=Automatic&lang=zh_CN 方法,但该方法仅适用于已命名轨道的视频.例如,此曲目没有任何命名的曲目(只有自动字幕)并且不会加载:rrkrvAUbU9Y

I tried using the http://video.google.com/timedtext?type=track&v=3wszM2SA12E&name=Automatic&lang=en method, but that one only works for those videos, which have named tracks. For example, this one doesn't have any named tracks (only automatic caption) and doesn't load up: rrkrvAUbU9Y

那里有几个可以执行此操作的网络应用程序(例如 http://www.serpsite.com/youtube-subtitles-download-tool/ http://mo.dbxdb. com/),但我需要一个脚本,因为我想将其用于研究.

There are several web-applications out there which can do it (like http://www.serpsite.com/youtube-subtitles-download-tool/ and http://mo.dbxdb.com/), but I need a script, because I want to use it for my research.

任何人都知道什么是正确的方法? YouTube的API有一些与字幕有关的内容,但仅适用于注册用户,而上面的应用程序可用于所有视频,我怀疑它们是否只是捕获了页面中的html代码(尽管这也是可能的).一定有办法...请帮忙!

Anyone has any ideas what is the correct way to get this? YouTube's API has something about captions, but only for registered users, while the apps above work for all videos and I doubt they just capture the html code from the page (although that's possible too). There must be a way... please help!

推荐答案

您需要先调用另一个API: http://video.google.com/timedtext?type=list&v=3wszM2SA12E

You need to call another API first: http://video.google.com/timedtext?type=list&v=3wszM2SA12E

这将为您提供可用曲目的列表.在您的情况下,只能获得一条轨道:id="0" name="Automatic" lang_code="en" lang_original="English" lang_translated="English" lang_default="true"

This will give you the list of the tracks available. In your case only one track can be obtained: id="0" name="Automatic" lang_code="en" lang_original="English" lang_translated="English" lang_default="true"

在这个特定的视频中,出于某些原因,我只能通过name=Automatic来解决音轨.但是对于另一个视频,它运行良好:

In this particular video I could address the track by name=Automatic only for some reasons. But for another video it worked fine:

http://video.google. com/timedtext?type = track& v = zenMEj0cAC4& id = 0 & lang = zh-CN

http://video.google.com/timedtext?type=track&v=zenMEj0cAC4&id=0&lang=en

这篇关于从YouTube视频中提取自动字幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆