azihassan / youtube-d

A fast command-line Youtube downloader
MIT License
6 stars 0 forks source link

Download gzipped assets #53

Closed azihassan closed 9 months ago

azihassan commented 9 months ago

base.js can be served with gzip encoding which makes it much smaller :

$ curl -LI https://www.youtube.com/s/player/cb886c6c/player_ias.vflset/ar_EG/base.js
HTTP/2 200 
accept-ranges: bytes
cross-origin-resource-policy: cross-origin
cross-origin-opener-policy-report-only: same-origin; report-to="youtube"
report-to: {"group":"youtube","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/youtube"}]}
content-length: 2507128
x-content-type-options: nosniff
server: sffe
x-xss-protection: 0
date: Sat, 27 Jan 2024 06:04:27 GMT
expires: Sun, 26 Jan 2025 06:04:27 GMT
cache-control: public, max-age=31536000
last-modified: Wed, 24 Jan 2024 05:49:18 GMT
content-type: text/javascript
vary: Accept-Encoding, Origin
age: 52165
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

$ curl -LI --compressed https://www.youtube.com/s/player/cb886c6c/player_ias.vflset/ar_EG/base.js
HTTP/2 200 
content-encoding: gzip
accept-ranges: bytes
cross-origin-resource-policy: cross-origin
cross-origin-opener-policy-report-only: same-origin; report-to="youtube"
report-to: {"group":"youtube","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/youtube"}]}
content-length: 791509
x-content-type-options: nosniff
server: sffe
x-xss-protection: 0
date: Sat, 27 Jan 2024 06:10:37 GMT
expires: Sun, 26 Jan 2025 06:10:37 GMT
cache-control: public, max-age=31536000
last-modified: Wed, 24 Jan 2024 05:49:18 GMT
content-type: text/javascript
vary: Accept-Encoding, Origin
age: 51802
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

HTML responses seem to ignore the --compressed flag, the response doesn't include a Content-Encoding header.