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

查看:44
本文介绍了获取隐藏式字幕“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:需要 {video 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 需要设置 name 参数.我的主要问题是如果设置了名称参数,我如何找到它.如果设置了,我怎么知道它是什么?

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?

推荐答案

您的第一个示例应该可以在没有 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天全站免登陆