Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
There is such a "secret" link: www.youtube.com/get_video_info?video_id=XXXXXX
Instead XXXXXX
, substitute the hash of the video, which is in the link to the video, such as youtu.be/BWCiWZtrWXU
after the slash.
This (first) link will return URL-encoded data. Unpack them and take the parameter url_encoded_fmt_stream_map
. Its value again needs to be unpacked as URL parameters. And extract the parameter from the result url
- this is a link to a single downloadable video file.
For example, in the browser console:
function getUrlParams(search) {
let hashes = search.slice(search.indexOf('?') + 1).split('&')
let params = {}
hashes.map(hash => {
let [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}
var s = '------'; // здесь длиннющая строка из ответа /get_video_info
var a = getUrlParams(s);
var b = getUrlParams(a.url_encoded_fmt_stream_map);
console.log(b.url); // эту ссылку открываем в браузере - это скачиваемый видеофайл
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question