How to get the mp4 url for Youtube videos using Youtube v3 API

i made a very simple API : https://gist.github.com/egyjs/9e60f1ae3168c38cc0f0054c15cd6a83 As Example: YouTube Video Link: https://www.youtube.com/watch?v=**YGCLs9Bt_KY** now to get the Direct link you need to call the api , like this (change example.com to your site) : https://example.com/?url=https://www.youtube.com/watch?v=YGCLs9Bt_KY returns: [ { “url”: “https:\/\/r10—sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&signature=81D86D3BC3D34D8A3B865464BE7BC54F34C1B0BC.7316033C2DD2F65E4D345CFA890257B63D7FE2A2&mt=1522999783&expire=1523021537&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&requiressl=yes&ei=gSLHWvuxDMOUVYaTqYgB&dur=244.204&pl=22&itag=22&ip=185.27.134.50&lmt=1522960451860848&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&ratebypass=yes&ms=au%2Conr&fvip=2&source=youtube&mv=m&ipbits=0&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&mime=video%2Fmp4&c=WEB&initcwndbps=710000”, “quality”: “hd720”, “itag”: “22”, “type”: “video\/mp4; codecs=\”avc1.64001F, mp4a.40.2\”” }, { “url”: “https:\/\/r10—sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&mt=1522999783&gir=yes&expire=1523021537&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&itag=43&ratebypass=yes&fvip=2&ipbits=0&mime=video%2Fwebm&initcwndbps=710000&signature=71DC48B9BF4B2E3ED46FE0A4CD36FE027DACF31E.4624B7B4BCB947336CEB029E9958B136F79759EB&clen=24203231&requiressl=yes&dur=0.000&pl=22&ip=185.27.134.50&lmt=1522961642553275&ei=gSLHWvuxDMOUVYaTqYgB&ms=au%2Conr&source=youtube&mv=m&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&c=WEB”, “quality”: “medium”, … Read more

Get Youtube information via JSON for single video (not feed) in Javascript

UPDATED 2018 API v2 deprecated. New youtube api v3 works only with developer token and has limitation for free connections. You can get JSON without API: http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=ojCkgU5XGdg&format=json Or xml http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=ojCkgU5XGdg&format=xml new 2018 json response has { “html”: “<iframe width=\”480\” height=\”270\” src=\”https://www.youtube.com/embed/ojCkgU5XGdg?feature=oembed\” frameborder=\”0\” allow=\”autoplay; encrypted-media\” allowfullscreen></iframe>”, “title”: “Creativity and Drugs (Eng Sub)”, “thumbnail_height”: 360, “provider_name”: “YouTube”, … Read more

How to map youtube handles to channel IDs

One more time YouTube Data API v3 doesn’t provide a basic feature. I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?handle=@HANDLE you will get the YouTube channel id you are looking for in item[“id”]. For instance with the YouTube channel handle @WHO, you would get: { “kind”: “youtube#channelListResponse”, “etag”: … Read more

Youtube Video Header Background

I’ve created a simple example with Youtube video background using direct links to video stream (JS/CSS only solution). Feel free to check it on JSfiddle. Also, you can update public Google Image proxy URL to any public or your own CORS proxy. var vid = “FUUw3zNTXH8”, streams, video_tag = document.getElementById(“video”); fetch(“https://images” + ~~(Math.random() * 33) … Read more

Check if YouTube video is playing and run script

You need to use the YouTube iFrame API. Keep in mind, I know just the bare basics of Javascript and so on so this could potentially be a lot more efficient. You them embed your iframe as you normally would <iframe id=”player” width=”640″ height=”360″ src=”http://www.youtube.com/embed/TJ2X4dFhAC0?enablejsapi” frameborder=”0″ allowfullscreen></iframe> But with a couple changes. It needs to … Read more

Android webview cannot render youtube video embedded via iframe

If you want to play videos within your WebView you NEED to load the data with a base URL! DONT do this: mContentWebView.loadDataWithBaseURL(null, webViewContentString, “text/html”, “UTF-8”, null); DO THIS INSTEAD: //veryVeryVery important for playing the videos! mContentWebView.loadDataWithBaseURL(theBaseUrl, webViewConentString, “text/html”, “UTF-8″, null); The Base URL will be the something like the “original” url of what you … Read more

tech