获取隐藏式字幕“cc"用于 Youtube 视频 [英] Get closed caption "cc" for Youtube video

查看:26
本文介绍了获取隐藏式字幕“cc"用于 Youtube 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何为任何有字幕的 Youtube 视频获取 CC 吗?我知道 API 2.0 文档中提到它仅适用于视频的所有者......但即使我不是任何视频的所有者,我也能够获得视频的一些标题......

Does any one know how to get the CC for any Youtube video that has the caption available? I know on the API 2.0 documentation mentions that it is only available for the owner of the video... but I was able to get some of the video's caption even though I'm not the owner of any....

有两个 API(或 API 链接)可以使用.他们都败给了 timpedtext API.在我提到它们之前,我们应该注意 API 需要的参数.分别是:

There are two APIs (or links to API) can be used. they both rout to timpedtext API. before I mention them we should note the parameters the API need. which are:

  • lang: {en, fr,...} 必需.
  • v:{视频 ID} 必需.
  • name:曲目名称,只有设置时才需要.(这是我的问题.)
  • tlang:翻译成语言.可选(如果您想将 CC 翻译成其他语言,应设置.
  • lang: {en, fr,...} required.
  • v: {video ID} required.
  • name: the track name, Required only if it is set. (and with this is my problem.)
  • tlang: translation to language. optional (should be set if you like to translate the CC to other language.

API 链接是:

  1. http://video.google.com/timedtext?lang=fr&v=PILzP-bIeLo&name=french请注意,如果您删除 name=French 或将其设置为其他内容,上述示例将不会返回任何内容...

  1. http://video.google.com/timedtext?lang=fr&v=PILzP-bIeLo&name=french Note the above example would return nothing if you remove the name=French or set it to something else...

http://www.youtube.com/api/timedtext?v=zzfCVBSsvqA&lang=en请注意,如果您将 name=...

http://www.youtube.com/api/timedtext?v=zzfCVBSsvqA&lang=en Note this example would return nothing if you set the name=...

http://www.youtube.com/api/timedtext?v=ZdP0KM49IVk&lang=en但实际的视频有字幕.

示例 3 不返回 CC 数据.

Example 3 does not return the CC data.

所以我猜测示例 3 需要设置名称参数.我的主要问题是如果设置了名称参数,我如何找到它.如果设置了,我怎么知道它是什么?

So I'm guessing that example 3 need to have the name parameter set. and my main problem is how do I find the name parameter if it is set or not. and if it is set how do I know what is it?

推荐答案

[update]:这是首选方法,直到谷歌最近停止使用它(截至 2021 年 12 月).

[update]: This was the preferred method until google recently discontinued it (writing as of dec 2021).

您的第一个示例应该可以在没有 name= 部分的情况下工作.这为我完成了工作:

Your first example should work without the name= part. This did the job for me:

video.google.com/timedtext?lang={languageID}&v={videoId}

要从上一个答案中获取英文 CC 版本,它看起来像这样:

To fetch the english CC version from the previous answer, it would look like this:

http://video.google.com/timedtext?lang=en&v=zzfCVBSsvqA

这篇关于获取隐藏式字幕“cc"用于 Youtube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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