I want to download/extract videos from youtube using Google Chrome Dev Tools. When I inspect the element, I see this in Dev Tools:
<video tabindex="-1" class="video-stream html5-main-video" controlslist="nodownload" style="width: 1004px; height: 753px; left: 0px; top: 0px;" src="blob:https://www.youtube.com/db4f4abe-c290-4e61-a904-68435fdd9933"></video>
I've tried going to Network -> searching for .mp4 and .flv but nothing is showing.
How can I download using Dev Tools? Also, is there a way to get the video link and have nothing but the video play in a new tab?
Thanks for your help.
Best Answer
Yes it is possible (maybe not legal) but I want to explain the technical part (note that I don't download videos from YouTube, there is no reason, as it is always there on the cloud!).
YouTube transmits those streams in bytearrays and if you check for one clear url it doesn't exist. BUT: if you look in the dev tools and trace the network you can find this url.
Take a look at this image:
YouTube transmits in separate channels and at runtime puts it all together, using XMLHttpRequest to get the video and audio separately.
All calls which start with
videoplayback?
are about the video/audio streaming. Thevideoplayback?
Ajax calls always come paired together:content-type= audio/*
andcontent-type= video/*
in some order.You can individuate them from the headers (in the image it looks like
content-type= video/*
orcontent-type= audio/*
)To GET FULL AUDIO/VIDEO STREAM THE ONLY THING TO DO IS : Change the parameter
RANGE
.The parameter
RANGE
specifies the segment of this content to stream (which is never normally the entire media since then it wouldn't be streaming, and to avoid downloads from nerd people)Copy the url which starts with
videoplayback?
(like is shown in the image). Find the parameterrange=
at the end of the querystring. The parameterrange=
is composed of a START and END (eg. range=18096-20098) which are separated by a “-”.Put 0 (zero) for START and a long number for END like 9999999999 (eg.
range=0-999999999999
). (Editor note, my guess is that these are the 'seconds' timestamps of the video)After you have modified this URL, copy and paste it in a new tab in your browser and you can simply download the audio or video.
Get both streams and put them together in some audio/video editing software (eg. NUENDO)
IMPORTANT: Don't change other parameters, as this is a self validating URL.