Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--geo-bypass does not add X-Forwarded-For HTTP-header #15547

Closed
eladkarako opened this issue Feb 9, 2018 · 1 comment
Closed

--geo-bypass does not add X-Forwarded-For HTTP-header #15547

eladkarako opened this issue Feb 9, 2018 · 1 comment
Labels

Comments

@eladkarako
Copy link

@eladkarako eladkarako commented Feb 9, 2018

I've used a packet inspector to figure out the network-traffic from YouTube-dl,
and it doesn't seems that --geo-bypass actually adds the X-Forwarded-For HTTP-header,
according to the documentations.

Bypass geographic restriction via faking X-Forwarded-For HTTP header (experimental)

This command-line:

call D:\DOS\YOUTUB~1\YOUTUB~1.EXE --hls-prefer-native --postprocessor-args "-hide_banner -strict experimental -threads 16 -loglevel info -flags "+low_delay+global_header-unaligned-ilme-cgop-loop-output_corrupt" -flags2 "+fast+ignorecrop+showall+export_mvs" -fflags "+genpts+nofillin+discardcorrupt-fastseek-ignidx" -movflags "+faststart+disable_chpl" -mpv_flags "+strict_gop+naq" -avoid_negative_ts "make_zero" -segment_time_metadata "1" -force_duplicated_matrix "1" -tune "zerolatency" -map_chapters "-1" -map_metadata "-1"" --ffmpeg-location "D:/DOS/YOUTUB~1/" --recode-video "mp4" --merge-output-format "mp4" --format "best[ext=mp4][height <=? 720]/bestvideo[ext=mp4][height <=? 720]+bestaudio[ext=mp3]/bestvideo[ext=mp4][height <=? 720]+bestaudio[ext=m4a]" --verbose --print-traffic --abort-on-error --http-chunk-size "10M" --force-ipv4 --geo-bypass --no-check-certificate --prefer-insecure --no-call-home --batch-file "list1.txt"

generated those HTTP requests (HTTP-headers only):

GET https://www.youtube.com/watch?gl=US&v=_Utq5qPD8gY&has_verified=1&disable_polymer=true&hl=en&bpctr=9999999999 HTTP/1.1
Connection: close
Accept-Encoding: gzip, deflate
Host: www.youtube.com
Accept-Language: en-us,en;q=0.5
Cookie: VISITOR_INFO1_LIVE=2pOJ68Ak8r8; PREF=f1=50000000&hl=en; YSC=PMlisrTwpl4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7


HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
Strict-Transport-Security: max-age=31536000
X-Frame-Options: SAMEORIGIN
P3P: CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info."
X-Content-Type-Options: nosniff
Expires: Tue, 27 Apr 1971 19:44:06 EST
X-XSS-Protection: 1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube
Date: Fri, 09 Feb 2018 20:11:54 GMT
Server: YouTube Frontend Proxy
Set-Cookie: s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw==; path=/; domain=.youtube.com
Alt-Svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
Connection: close
Content-Length: 208491



------------------------------------------------------------------
GET http://www.youtube.com/get_video_info?ps=default&disable_polymer=true&el=embedded&sts=17570&eurl=&gl=US&hl=en&video_id=_Utq5qPD8gY HTTP/1.1
Host: www.youtube.com
Connection: close
Accept-Encoding: gzip, deflate
Accept-Language: en-us,en;q=0.5
Cookie: VISITOR_INFO1_LIVE=2pOJ68Ak8r8; PREF=f1=50000000&hl=en; YSC=PMlisrTwpl4; s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw==
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7


HTTP/1.1 200 OK
P3P: CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info."
X-XSS-Protection: 1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Expires: Tue, 27 Apr 1971 19:44:06 EST
Content-Length: 66016
Date: Fri, 09 Feb 2018 20:12:02 GMT
Server: YouTube Frontend Proxy
Set-Cookie: s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw==; path=/; domain=.youtube.com
Connection: close



------------------------------------------------------------------
GET https://r2---sn-nhpax-ua8s.googlevideo.com/videoplayback?ratebypass=yes&lmt=1518190989246166&ms=au%2Crdu&initcwndbps=947500&source=youtube&ipbits=0&fvip=5&dur=1504.931&ei=igB-WoyOEdGH8gOXmZq4CA&itag=22&expire=1518228714&c=WEB&ip=77.126.65.20&requiressl=yes&beids=%5B9466593%5D&mime=video%2Fmp4&key=yt6&mt=1518207011&mv=m&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&id=o-APnK-ATX3N1Rxr8WpU4aoKi2-PyxjX5El1sPor5WJpzQ&pl=21&mm=31%2C29&mn=sn-nhpax-ua8s%2Csn-4g5e6nls&signature=8D8C41B8EE6D05F356D8A0730C647E94D11201ED.5374EDDD58B66FE7141EC8DB1B49C46388A0D353 HTTP/1.1
Accept-Encoding: identity
Connection: close
Host: r2---sn-nhpax-ua8s.googlevideo.com
Accept-Language: en-us,en;q=0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7


HTTP/1.1 200 OK
Last-Modified: Fri, 09 Feb 2018 15:43:09 GMT
Content-Type: video/mp4
Date: Fri, 09 Feb 2018 20:12:11 GMT
Expires: Fri, 09 Feb 2018 20:12:11 GMT
Cache-Control: private, max-age=21283
Accept-Ranges: bytes
Content-Length: 219747077
Connection: close
Alt-Svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
X-Content-Type-Options: nosniff
Server: gvs 1.0



------------------------------------------------------------------


Ps. this was done using the native downloader (as can be seen from the command-line above), but when switched to using the external-downloader `aria2c`, which supports `--header="KEY: VALUE"` too - it didn't seems to generate any `X-Forwarded-For` headers either.
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 9, 2018

You did not provide --geo-bypass-country.
Also you don't even need to use --geo-bypass on your own. It's done automatically when appropriate.

@dstftw dstftw closed this Feb 9, 2018
@dstftw dstftw added the invalid label Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.