Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

safari - youtube get_video not working

I used http://www.youtube.com/get_video?video_id=ID&t=SIGNATURE&fmt=18 replaced

ID and SIGNATURE with the proper values. But I don't get see any save or download window,

instead A blank window.

I am in Macintosh platform with Safari browser. Help Appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Easiest way to grab information on a youtube video is to get the source from http://youtube.com/get_video_info?video_id=XXXXXXXX

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);

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

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...