Permalink
Browse files

Update approaches and results

  • Loading branch information...
TomasHubelbauer committed Jan 12, 2018
1 parent deee710 commit 8ded071eaceddad8b17b9bfef52e56e977ba7ee5
Showing with 15 additions and 5 deletions.
  1. +15 −5 README.md
@@ -1,10 +1,20 @@
# Puppeteer YouTube Downloader
This is an experiment in using Chrome's Puppeteer to download YouTube videos by letting them play and stitching together the `videoplayback` responses.
The responses have a `rn` parameter (as well as a `range` one) which could be used to ensure they are stiched together in order.
The video could be seeked through in order to speed up the download while still acting almost indistinguishably from a real user to YouTube.
This is an experiment in using Chrome's Puppeteer to download YouTube videos.
## Limitations
Chromium which comes bundled with Puppeteer won't play media formats other than VP8 and VP9.
Puppeteer can be used to control Chrome which has the necessary codecs.
## Approaches
**Downloading the BLOB URL.** This would ordinarily work, but EME `MediaSource` BLOB URLs are *automatically revoked* and [won't download when pointed to explicitly or implicitly by creating a download link](https://stackoverflow.com/a/36488042/2715716).
**Stiching together `videoplayback` chunks.*** The responses have a `rn` parameter (as well as a `range` one) which could be used to ensure they are stiched together in order. The video could be seeked through in order to speed up the download while still acting almost indistinguishably from a real user to YouTube.
There is a risk of quality change during playback which would result in incompatible chunks, selecting quality prior to playback explciitly might resolve this problem.
## Results
Turns out default Chromium bundled with Puppeteer doesn't support non-free media formats (should have thought about that).
It will play VP8 and VP9 though.
See the code.

0 comments on commit 8ded071

Please sign in to comment.