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

youtube geo bypass doesnt work #32978

Closed
4 of 6 tasks
Fjox opened this issue Nov 22, 2024 · 5 comments
Closed
4 of 6 tasks

youtube geo bypass doesnt work #32978

Fjox opened this issue Nov 22, 2024 · 5 comments

Comments

@Fjox
Copy link

Fjox commented Nov 22, 2024

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2021.12.17
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--geo-bypass', 'https://www.youtube.com/watch?v=ah8zhRa5-CA']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2024.08.07 [c5098961b] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 3.4.4 (CPython AMD64 32bit) - Windows-10-10.0.19041 - OpenSSL 1.0.2d 9 Jul 2015
[debug] exe versions: ffmpeg n7.1-36-g20c8a3f5ff-20241121, ffprobe n7.1-36-g20c8a3f5ff-20241121
[debug] Proxy map: {}
[youtube] ah8zhRa5-CA: Downloading webpage
ERROR: Video unavailable
The uploader has not made this video available in your country
Traceback (most recent call last):
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 879, in wrapper
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 975, in __extract_info
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\common.py", line 571, in extract
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\youtube.py", line 2248, in _real_extract
youtube_dl.utils.ExtractorError: Video unavailable
The uploader has not made this video available in your country

Description

Im trying to download a video that the uploader limited to america from germany, i tried --geo-bypass and --geo-bypass-country and they didnt work.

@dirkf
Copy link
Contributor

dirkf commented Nov 22, 2024

  1. AFAIK YouTube doesn't recognise the XFF header that the --geo-... options use, so there's no point using them with YT.
  2. Even if the site believed the IP address in the XFF header, the YT extractor doesn't know which country to simulate, as you can see from the lack of a line like [debug] Using fake IP ... as X-Forwarded-For which appears when you use --geo-bypass-country US.
  3. From UK (not yet a US State), the video is accessible to yt-dl regardless of --geo-... options (ie, with/without).

If your experience differs, you have to use a proxy or VPN or take a flight.

Maybe a YT front-end (Invidious, Piped, etc) will do as a proxy, but as I'm not blocked from the content I can't tell. Also see #32905.

@Fjox
Copy link
Author

Fjox commented Nov 22, 2024

debug log for the other option

[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--geo-bypass-country', 'US', 'https://www.youtube.com/watch?v=ah8zhRa5-CA', '-v']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2024.08.07 [c5098961b] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 3.4.4 (CPython AMD64 32bit) - Windows-10-10.0.19041 - OpenSSL 1.0.2d 9 Jul 2015
[debug] exe versions: ffmpeg n7.1-36-g20c8a3f5ff-20241121, ffprobe n7.1-36-g20c8a3f5ff-20241121
[debug] Proxy map: {}
[debug] Using fake IP 6.70.233.40 (US) as X-Forwarded-For.
[youtube] ah8zhRa5-CA: Downloading webpage
ERROR: Video unavailable
The uploader has not made this video available in your country
Traceback (most recent call last):
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 879, in wrapper
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 975, in __extract_info
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\common.py", line 571, in extract
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\youtube.py", line 2248, in _real_extract
youtube_dl.utils.ExtractorError: Video unavailable
The uploader has not made this video available in your country``` 

@Fjox
Copy link
Author

Fjox commented Nov 22, 2024

got a vpn for it and it didnt work

Traceback (most recent call last):
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 2156, in process_info
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 2092, in dl
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\common.py", line 380, in download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\dash.py", line 53, in real_download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\fragment.py", line 111, in _download_fragment
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\common.py", line 380, in download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\http.py", line 349, in real_download
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\downloader\http.py", line 110, in establish_connection
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py", line 2500, in urlopen
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\urllib\request.py", line 464, in open
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\urllib\request.py", line 482, in _open
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\urllib\request.py", line 442, in _call_chain
  File "D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\utils.py", line 2897, in https_open
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\urllib\request.py", line 1186, in do_open
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\http\client.py", line 1227, in getresponse
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\http\client.py", line 386, in begin
  File "C:\hostedtoolcache\windows\Python\3.4.4\x86\lib\http\client.py", line 356, in _read_status
http.client.BadStatusLine: ''

The secound time i tried i got 403 errors

@Fjox
Copy link
Author

Fjox commented Nov 22, 2024

yeah yt-dlp works fine with a vpn but youtube-dl doesnt. wierd

@dirkf
Copy link
Contributor

dirkf commented Nov 22, 2024

yt-dlp may be sending various modern headers that improve its chance of not being blocked through the VPN (Sec-..., eg). But the source address shown by your VPN may not be constant either, and YT extensively blocks what it thinks are VPNs or data centres, with plenty of examples in the yt-dlp issue tracker.

If using an Invidious instance, you would have to get the download link from the webpage (if available) because controversially the YT extractor redirects from a known Invidious instance to YT. This should be changed but probably --extractor-args ... should be implemented first in case anyone wants to maintain the existing weird behaviour. And the same applies to a Piped or unknown Invidious instance which aren't handled at all.

@dirkf dirkf closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants