Troubleshooting youtube-dl Installation and Video Download Issues

2024-05-14 21:58:34.241344 +0800 CST 13 min read views: 116

When I started, I used pip to install youtube-dl:

C:\Users\Administrator\Desktop\1>pip install --upgrade youtube-dl
Collecting youtube-dl
  Downloading youtube_dl-2021.12.17-py2.py3-none-any.whl.metadata (1.5 kB)
Downloading youtube_dl-2021.12.17-py2.py3-none-any.whl (1.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 1.2 MB/s eta 0:00:00
Installing collected packages: youtube-dl
Successfully installed youtube-dl-2021.12.17

C:\Users\Administrator\Desktop\1>youtube-dl
Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

However, it seemed not to work. When I tried to download a video using the following command:

C:\Users\Administrator\Desktop\1>youtube-dl -v -f 'bestvideo+bestaudio/best' https://www.youtube.com/watch?v=DQacCB9tDaw

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', "'bestvideo+bestaudio/best'", 'https://www.youtube.com/watch?v=DQacCB9tDaw']
[debug] Encodings: locale cp936, fs utf-8, out utf-8, pref cp936
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.12.2 (CPython) - Windows-11-10.0.22631-SP0
[debug] exe versions: ffmpeg 2024-03-28-git-5d71f97e0e-full_build-www.gyan.dev, ffprobe 2024-03-28-git-5d71f97e0e-full_build-www.gyan.dev
[debug] Proxy map: {'https': '127.0.0.1:10809'}
[youtube] DQacCB9tDaw: Downloading webpage
ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "C:\Python312\Lib\site-packages\youtube_dl\YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\youtube_dl\YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
                ^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\youtube_dl\extractor\common.py", line 534, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\youtube_dl\extractor\youtube.py", line 1794, in _real_extract
    'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\youtube_dl\extractor\common.py", line 1012, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

An error occurred. The error message indicated that at least one URL needed to be provided. Then, I attempted a reinstallation:

pip install --upgrade --force-reinstall "git+https://github.com/ytdl-org/youtube-dl.git"

And that was the final solution.