某些网站如何下载 YouTube 字幕? [英] How do some sites download YouTube captions?

查看:37
本文介绍了某些网站如何下载 YouTube 字幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与 YouTube API 是否禁止下载视频字幕(如果您不是其所有者)的问题有些重复?, 获取 YouTube 字幕是否可以如果你不是它的所有者,YouTube API 禁止下载视频字幕?,这基本上都说除非你是所有者或第三方贡献未启用,否则除非通过 YouTube API 下载字幕,否则不可能;但是,我的问题是如何访问像 http://downsub.com/http://www.lilsubs.com/ 可以访问所有字幕吗?

This is somewhat of a duplicate question of Does YouTube API forbid to download video captions if you are not it's owner?, Get YouTube captions and Does YouTube API forbid to download video captions if you are not it's owner?, which all basically say it's not possible unless to download captions via the YouTube API unless you are the owner or third-party contributions are not enabled; however, my question is how to sites like http://downsub.com/ or http://www.lilsubs.com/ have access to all captions?

换句话说,当我自己访问 YouTube API 时(即使使用 youtubepartneryoutube.force-ssl 范围),我只能下载某些视频的字幕,但是当我尝试使用 403 失败的相同视频时:与请求关联的权限不足以下载字幕轨道.请求可能没有得到正确授权,或者视频订单可能没有为此字幕启用第三方贡献. 在这些其他网站上,它工作正常.我假设他们使用 YouTube API 来访问字幕,但他们使用的是什么特殊调味料?一些特殊的合作伙伴密钥?不同的 API 版本?他们只是从视频本身或其他内容中抓取吗?

In other words, when I access the YouTube API myself (even with youtubepartner and youtube.force-ssl scopes), I can only download the captions of some videos, but when I try the same videos that failed for me with 403: The permissions associated with the request are not sufficient to download the caption track. The request might not be properly authorized, or the video order might not have enabled third-party contributions for this caption. on these other sites, it works fine. I'm assuming they are using the YouTube API to access the captions, but what special sauce are they using? Some special partner key? An different API version? Are they just scraping from the videos themselves or something?

推荐答案

发送 GET 请求:

http://video.google.com/timedtext?lang={LANG}&v={VIDEOID}

评论中的视频示例:http://video.google.com/timedtext?lang=ko&v=0db1_qWZjRA

让我们看看你的另一个例子,即 https://www.youtube.com/watch?v=7068mw-6lmI(我同意您评论中的差异化部分).

Let's look at another example of yours, i.e. https://www.youtube.com/watch?v=7068mw-6lmI (and I agree about differentiation part in your comment).

视频有多个字幕

  • 英语
  • 韩文
  • 西班牙语
  • 韩语(自​​动生成)也称为 asr(自动语音识别)

这些代表副标题 name 参数(即 name=English).

These stand for the subtitle name parameter (i.e., name=English).

lang 代表国家代码.在您的示例中:https://www.youtube.com/api/timedtext?lang=es-MX&v=7068mw-6lmI&name=Spanish

lang stands for the country code. In your example: https://www.youtube.com/api/timedtext?lang=es-MX&v=7068mw-6lmI&name=Spanish

如果字幕轨道可用,可以对其进行翻译,即使用tlang参数.

If subtitle track is available, it is possible to do translation form it, namely using tlang parameter.

https://www.youtube.com/api/timedtext?lang=en&v=7068mw-6lmI&name=English&tlang=lv
https://www.youtube.com/api/timedtext?lang=ko&v=7068mw-6lmI&name=Korean&tlang=lv

这将是我对这些网站正在使用的内容的出价,即可用字幕轨道的翻译(通过尝试使用没有字幕轨道的视频作为其网站之一的输入来确认).

This would be my bid for what these sites are using, i.e. translation of the available subtitle track (confirm by trying to use a video without subtitle track as input for one of their sites).

至于 asr 签名似乎总是需要的,但只要其中一个字幕轨道可用,您就可以使用它进行翻译.例如.在您的 OP 评论示例中:

As for asr signature seems to always be needed, but as long as one of the subtitle tracks are available, you could use that for translation. E.g. in your OP comment example:

https://www.youtube.com/api/timedtext?lang=en&v=vx6NCUyg1NE&tlang=lv

看起来最后一个例子很特别,两个字幕轨道都是 asr(用 Chrome 检查 -> Inspect -> Network),因此你需要省略副标题 name 参数部分.遗憾的是,在 YouTube 视频的设置轮中看不到这种差异.

Looks like the last example is special with both of subtitle tracks being asr (checked with Chrome -> Inspect -> Network) therefore you need to omit the subtitle name parameter part. This difference unfortunately is not visible in YouTube video's settings wheel.

这篇关于某些网站如何下载 YouTube 字幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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