Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get HTML5 video URL from youtube 's HTML5 version?

I am not able to find tag in the source code of html5 version of youtube.

Q.1). Any idea on how it is playing HTML5 video without video element?

one option is that it is adding video element from JS, but I am not able to find out video element even in DOM of web-inspector.

Q.2). How to find video element in web-inspector or in firebug?

PS: I am novice in web-development.

like image 675
SunnyShah Avatar asked Jul 13 '11 08:07

SunnyShah


People also ask

How do I find the URL for a YouTube video?

In your browser, open YouTube. Find and click the video whose URL you want to see. The URL of the video will be in the address bar.

Is YouTube an HTML5 video?

YouTube today announced it has finally stopped using Adobe Flash by default. The site now uses its HTML5 video player by default in Google's Chrome, Microsoft's IE11, Apple's Safari 8, and in beta versions of Mozilla's Firefox browser. At the same time, YouTube is now also defaulting to its HTML5 player on the web.

How do I get the URL of a video browser?

To find the Video URL, simply visit the video online, copy the URL within the address bar of your browser, and paste this within the Video ID box of the Video Widget. When you paste in the Video URL to the widget, it will automatically shorten to the Video ID.


2 Answers

It's definitely there. I picked a video at random, and:

<video 
    class="video-stream" x-webkit-airplay="allow" data-youtube-id="iF83wwij828" 
    poster="http://i2.ytimg.com/vi/iF83wwij828/hqdefault.jpg" 
    src="http://v14.lscache3.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass%2Coc%3AU0hQRVVRV19FSkNOMF9NS0FD&amp;itag=43&amp;ip=0.0.0.0&amp;signature=60D26B708E92E1636CA3B34A389B1A4406DF290F.BD57D8B601A61EFF68CEF6726754DAD6D9C7C2A9&amp;sver=3&amp;ratebypass=yes&amp;expire=1310569200&amp;key=yt1&amp;ipbits=0&amp;id=885f37c308a3f36f">
</video>

My browser: Chrome 12.0.742.100 on Mac OS X, with Developer Tools -> Elements tab -> Search for "<video"

Developer Tools will show what's rendered to the end-user, unlike "view source".

Alternatively, have a look inside the JavaScript file called watch. I found this around line 1464:

'PLAYER_CONFIG':
    {"url": "http:\/\/s.ytimg.com\/yt\/swfbin\/watch_as3-vfl7OZAr4.swf",
     "min_version": "8.0.0", 
    "args": {"rv.2.thumbnailUrl": "http:\/\/i4.ytimg.com\/vi\/_jjXCm3W4hA\/default.jpg",
    "rv.7.length_seconds": 374, 
    "rv.0.url": "http:\/\/www.youtube.com\/watch?v=fvVJ7U-TekE", 
    "rv.0.view_count": 14234, 
    "enablecsi": "1", 
    "rv.2.title": "Alan Grayson (HD): \"Which Foreigners Got the Fed's $500,000,000,000?\"  Bernanke: \"I Don't Know.\"", 
    "rv.4.rating": "", "rv.3.view_count": 8109, "is_doubleclick_tracked": "1",
    "rv.4.thumbnailUrl": "http:\/\/i1.ytimg.com\/vi\/PlaFDyjCeVQ\/default.jpg", 
    "fmt_url_map": "34|http:\/\/o-o.preferred.lhr14s07.v21.lscache6.c.youtube.com\/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Calgorithm%2Cburst%2Cfactor%2Coc%3AU0hQRVVSVF9FSkNOMF9NTFhF\u0026algorithm=throttle-...

I guess if you match for fmt_url_map, you'll find it.

like image 71
opyate Avatar answered Nov 15 '22 13:11

opyate


I found an even easier way to get the URL.

  1. Go to http://en.fetchfile.net/ (or any other site that lets you download videos from youtube and similar sites)
  2. Paste the youtube video link (from the browser address bar)
  3. It shows you links to download the video which is actually the video link. See screenshot below. You can right click on the 'Download video' button and 'copy link address'. You now have the actual video URL from the server.

enter image description here

This also works a lot of other sites using HTML5 video where the video link is not available in view source.

like image 37
Pankaj C. Avatar answered Nov 15 '22 13:11

Pankaj C.