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 video download failed with urlopen error [Errno 0] #33013

Open
6 tasks done
donargreys opened this issue Dec 31, 2024 · 4 comments
Open
6 tasks done

youtube video download failed with urlopen error [Errno 0] #33013

donargreys opened this issue Dec 31, 2024 · 4 comments

Comments

@donargreys
Copy link

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

➜  ~ youtube-dl -F -v  'https://www.youtube.com/watch?v=4--Porr54oo'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-F', '-v', 'https://www.youtube.com/watch?v=4--Porr54oo']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2024.12.17 [d55d1f423] (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.7.5 (CPython x86_64 64bit) - Darwin-24.2.0-x86_64-i386-64bit - OpenSSL 1.1.1w  11 Sep 2023
[debug] exe versions: ffmpeg 7.1, ffprobe 7.1, rtmpdump 2.4
[debug] Proxy map: {'all': 'socks5://127.0.0.1:10808'}
[youtube] 4--Porr54oo: Downloading webpage
WARNING: Unable to download webpage: <urlopen error [Errno 0] Error>
Traceback (most recent call last):
  File "/Users/handong/.pyenv/versions/3.7.5/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/handong/.pyenv/versions/3.7.5/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 477, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 467, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2258, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 872, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 879, in wrapper
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 975, in __extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 571, in extract
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1954, in _real_extract
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 347, in _extract_ytcfg
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 1078, in _search_regex
  File "/Users/handong/.pyenv/versions/3.7.5/lib/python3.7/re.py", line 183, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

Description

download youtube video https://www.youtube.com/watch?v=4--Porr54oo failed with <urlopen error [Errno 0] Error> on macos 15.2 (24C101)

@dirkf
Copy link
Contributor

dirkf commented Dec 31, 2024

Because yt-dl was unable to read the webpage through your socks5: proxy, as in <urlopen error [Errno 0] Error>. You should see how it works with other applications and sites, including browser access to the problem page. Maybe YT hates the internet-facing side of your proxy.

Although it would presumably have failed later, this specific line extractor/youtube.py:1954 shouldn't have failed (why the original failure was a WARNING). Instead of webpage, it should be looking at webpage or ''.

dirkf added a commit that referenced this issue Dec 31, 2024
@donargreys
Copy link
Author

my browser and curl both worked fine with my sock5, i wonder what goes wrong with youtube-dl?

@dirkf
Copy link
Contributor

dirkf commented Jan 1, 2025

I had no success with any of several public socks5 proxies, either with curl (--preproxy socks5://ip:port) or with yt-dl (--proxy socks5://ip:port). Whereas without any proxy there's no problem; but presumably you are deploying the proxy for a good reason.

@dirkf
Copy link
Contributor

dirkf commented Jan 1, 2025

The latest nightly build should survive failing to download the original page but I don't expect that to resolve your proxy issue.

#27800 was similar, but not fully resolved.

As it's your proxy, you could consider (enabling if necessary and) reviewing any logs that it generates to see what is actually happening when Python fails with urlopen error [Errno 0].

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