Saturday, 1 September 2018
How To Obtain YouTube Video Download Url Just Like KeepVid (2017)
------------------------------------------------------------------------------------------------------------------
How To Obtain YouTube Video Download Url Just Like KeepVid (2017)
READ MORE:
videoplayback download in javascript
https://stackoverflow.com/questions/45246837/how-to-obtain-youtube-video-download-url-just-like-keepvid-2017
https://github.com/wix/vidi
----------------------------------------------------------------------------------------------------------------------
I'm writing a youtube video downloader. Let's use this video as an example:
When researching how to grab a YouTube video's url, I came across a snippet of code right here on stackoverflow:
------------------------------------------------------------------------------------------------------------------
PASTE BELOW CODE IN CONSOLE------------------------------------------------------------------------------------------------------------------
(function() {
return ytplayer.config.args.adaptive_fmts
.split(',')
.map(item => item
.split('&')
.reduce((prev, curr) => (curr = curr.split('='),
Object.assign(prev, { [curr[0]]: decodeURIComponent(curr[1]) })
), {})
)
.reduce((prev, curr) => Object.assign(prev, {
[curr.quality_label || curr.type]: curr
}), {});
})();
------------------------------------------------------------------------------------------------------------------WE CAN WRITE ABOVE CODE IN THIS WAY
-----------------------------------------------------------------------------------------------------------------
var ytplayer;
function FunctionName(ytplayer){
return ytplayer.config.args.adaptive_fmts
.split(',')
.map(item =>
item
.split('&')
.reduce((prev,
curr) => (curr = curr.split('='),
Object.assign(prev, { [curr[0]]: decodeURIComponent(curr[1]) })
), {})
)
.reduce((prev,
curr) => Object.assign(prev, {
[curr.quality_label
|| curr.type]: curr
}), {});
}
FunctionName(ytplayer);
------------------------------------------------------------------------------------------------------------------READ MORE:
search this line in google
ytplayer.config.args.adaptive_fmts
https://www.google.co.uk/search?q=ytplayer.config.args.adaptive_fmts&rlz=1C1CHBD_en-GBGB813GB813&oq=ytplayer.config.args.adaptive_fmts&aqs=chrome..69i57.453j0j7&sourceid=chrome&ie=UTF-8
https://gist.githubusercontent.com/vsubhash/cc950f855714b2e6bbef/raw/6e857227ce3f91cdee4ae3f5f843b18ead20c49e/com.vsubhash.js.youtube-downloader
USE OFFLINE CODE IN CONSOLE
SAMPLE VIDEO
https://www.youtube.com/watch?v=qTP3efPeBOI
https://www.youtube.com/watch?v=FBsuHLgwnIU
https://www.youtube.com/watch?v=Qp9EcTiu09U
------------------------------------------------------------------------------------------------------------------
arFormats = ytplayer.config.args.url_encoded_fmt_stream_map.split(",");
for (i = 0; i < arFormats.length; i++) {
//console.error("Format " + i + ".
" + arFormats[i]);
arFormatParams = arFormats[i].split("&")
sURL = "";
for (j = 0; j < arFormatParams.length; j++) {
// console.error("\tFormat parameter " +
arFormatParams[j]);
if (arFormatParams[j].indexOf("url=") > -1) {
sURL = unescape(arFormatParams[j].substring("url=".length));
} else {
if (arFormatParams[j].indexOf("type=") > -1) {
sMimeType = unescape(arFormatParams[j].substring("type=".length));
}
if (arFormatParams[j].indexOf("quality=") > -1) {
sQuality = arFormatParams[j].substring("quality=".length);
}
}
}
if ((sURL.length
> 0) && (sQuality.length > 0) && (sMimeType.length >
0)) {
oOption = document.createElement("option");
oOption.text = sQuality + "
- " + sMimeType;
sURL = sURL +
"&ptk=youtube_none&pltype=contentugc" +
"&title=" +
escape(ytplayer.config.args.title);
}
}
-------------------------------------------------------------------------------------------------------------------OR USE THIS CODE:
--------------------------------------------------------------------------------------------------------------------
var arFormats,arFormatParams,ytplayer,i,j,sURL,unescape;
arFormats = ytplayer.config.args.url_encoded_fmt_stream_map.split(",");
for (i = 0; i < arFormats.length; i++) {
//console.error("Format " + i + ".
" + arFormats[i]);
arFormatParams = arFormats[i].split("&");
sURL = "";
for (j = 0; j < arFormatParams.length; j++) {
// console.error("\tFormat parameter " +
arFormatParams[j]);
if (arFormatParams[j].indexOf("url=") > -1) {
sURL = unescape(arFormatParams[j].substring("url=".length));
}
}
}
----------------------------------------------------------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment