youtube get_video 不工作 [英] youtube get_video not working
问题描述
我使用了 http://www.youtube.com/get_video?video_id=ID&t=SIGNATURE&fmt=18 已替换
ID 和 SIGNATURE 具有正确的值.但我没有看到任何保存或下载窗口,
ID and SIGNATURE with the proper values. But I don't get see any save or download window,
而是一个空白窗口.
我在 Macintosh 平台上使用 Safari 浏览器.感谢帮助.
I am in Macintosh platform with Safari browser. Help Appreciated.
推荐答案
获取 youtube 视频信息的最简单方法是从 http://youtube.com/get_video_info?video_id=XXXXXXXX获取源代码>
Easiest way to grab information on a youtube video is to get the source from http://youtube.com/get_video_info?video_id=XXXXXXXX
我将使用 PHP 作为处理这些数据的示例.使用 PHP 的 parse_str() 您可以将字符串的所有变量分配给一个不错的视频信息数组:
I will use PHP as an example of handling this data. Using PHP's parse_str() you can assign all variable of the string to a nice array of video info:
$content = file_get_contents("http://youtube.com/get_video_info?video_id=".$id);
parse_str($content, $ytarr);
然后将所有信息存储到 $ytarr 中.感兴趣的变量是fmt_list"和fmt_map"(它们似乎包含相同的东西afaik).根据此处的图表,此变量包含可用视频格式的列表:http://en.wikipedia.org/wiki/Youtube#Quality_and_codecs
Then all the info is stored into $ytarr. Variables of interest would be "fmt_list" and "fmt_map" (which appear to contain the same thing afaik). This variable contains a list of available video formats in accordance to the chart here: http://en.wikipedia.org/wiki/Youtube#Quality_and_codecs
假设您知道要下载哪些格式,然后可以使用fmt_url_map"变量(或在本例中为 $ytarr['fmt_url_map'])访问链接列表到所需的格式.
Assuming you know which of those formats you wish to download, you can then use the "fmt_url_map" variable (or $ytarr['fmt_url_map'] in this example) to access the list of links to the desired format.
您可以使用这些链接下载任何格式的视频,但它们受制于 youtube 的有限带宽(youtube 用于节省带宽的最佳流媒体速度),因此下载速度不会像您想象的那么快.这让我相信这些链接最适合用于流式传输而不是下载,但我不知道有任何替代方法.
You can download videos of any format using those links, but they are subject to youtube's limited bandwidth (the optimal streaming speed youtube uses to save on bandwidth) so therefore the downloads won't be quite as fast as you would imagine. This leads me to believe that these links are best used for streaming rather than downloading, but I'm not aware of any alternative.
这篇关于youtube get_video 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!