On Thu 2022-03-24 08:14:01 +1100, Yuchen Pei wrote: > On Wed 2022-03-23 20:32:36 +0100, Alexandre Garreau wrote: > >> >> I don’t see how GET/POST is related: you can use POST without any javascript >> (both POST and PUT existed before javascript), while for youtube, even any >> GET >> statement provides nothing but a blank page, and you need to execute >> javascript to get anything. >> > > You can download a yt video by GET only: > > wget -O- 2>/dev/null https://youtube.com/watch?v=dQw4w9WgXcQ | grep -oP > 'ytInitialPlayerResponse\s*=\s*(.+)\s*;</script>' | grep -o '\{.*\}' | > jq .
This is better: wget -O- 2>/dev/null https://youtube.com/watch?v=dQw4w9WgXcQ | grep -oP 'ytInitialPlayerResponse\s*=\s*.+\s*;</script>' | grep -o '\{.*\}' | jq '."streamingData"' >From my experiments I've noticed that if you request the same video id multiple times, initially there's no cipher (you get an "url" field for each format), but after a few times requesting the same page, you may get a "signatureCipher" field instead which would need the js interpreter somehow according to the youtube-dl code. > > There you get a json with all the video / audio formats and their links. > > Best, > Yuchen Best, Yuchen -- PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0 <https://ypei.org/assets/ypei-pubkey.txt>
