A
A
Alex2021-11-04 22:00:29
YouTube
Alex, 2021-11-04 22:00:29

Download YouTube video via DevTools?

Good day to all! Can you please tell me how can I download YouTube video through DevTools?
I know that can be downloaded through various sites or yt-dlp. But how to do it without them?
In the console only xhr files go. Maybe there is a way to get a link to the video?

Update:
I managed to pull the video from the console as I needed.
1) Choose the video you want.
2) Before starting the video, choose the quality you need.
3) Open Developer tools - Network and run the video for a few seconds
4) In the Network tab, after the video starts playing, files will appear with the name videoplayback?expire=...
Some of these files with the name videoplayback?expire=... refer to video file, and some to the sound.
5) Open the link to the file in a new tab, there will be a window with the video, but there is nothing there.
6) In the address bar at the very end, look for &range=some number-some number. For example, &range=1680777-2230746 and write it as &range=0-99999999999999999. There can be as many nines or other numbers as you like. As I understand it, this is the size of the file in bytes. This will download the entire file.
7) Refresh the page with the changed &range and download the resulting file. It will be either video or audio.
In order not to check all links in a row in order to determine whether it is a video file or an audio file, the format is specified in the content-type on the right in the headers section.
Well, then you glue it through ffmpeg or whatever you like video + audio.
Maybe someone will find it useful.
And so, use yt-dlp)
PS I'm not a programmer.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2021-11-05
@Casufi

No way, YouTube does not give the video in one file

D
Dmitry, 2022-01-09
@itskov

I will quote from the instructions in English. Checked, this method works.
To reach the direct video and audio links: (using Chrome)

  1. Navigate to the desired youtube video.
  2. Press F12 to open Chrome DevTools, and then select the 'Network' tab.
  3. Ensure network recording log is turned on, indicated by the red circle near the top-left. To enable, press the black circle or press 'Ctrl-E'.
  4. In the filter box, search for 'mime=video'. If you just turned on network recording you may to press 'F5' to refresh in order to see results.
  5. Right click on the entry nearest the bottom and select 'Open in new tab'.
  6. In the new tab, you'll be faced with an empty media player that doesn't work. The URL is very long, and you will need to modify it slightly to allow the video to play. Near the end of the URL you will find a 'range' parameter similar to this: &range=15880614-17942602
  7. Remove this section of the URL and renavigate to the URL.
  8. You now have a direct video download link. You can view the video from this URL or right-click on the video frame to download locally.
  9. Repeat from step 4 using 'mime=audio' in the filter to download the audio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question