blackjack4494 / yt-dlc

media downloader and library for various sites.
The Unlicense
2.89k stars 363 forks source link

[Feature Request] Youtube 'private' videos should generate a better error message #199

Open bani6809 opened 3 years ago

bani6809 commented 3 years ago

Checklist

Description

WRITE DESCRIPTION HERE

youtube videos which are 'private' generate a cryptic error message:

PS D:\> youtube-dlc.exe --ignore-config --verbose https://www.youtube.com/watch?v=Neu64e3ODR8
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ignore-config', '--verbose', 'https://www.youtube.com/watch?v=Neu64e3ODR8']
[debug] Loading archive file None
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dlc version 2020.11.11-3
[debug] Python version 3.8.6 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg N-99909-g454bee5be0, ffprobe N-99909-g454bee5be0
[debug] Proxy map: {}
[youtube] Neu64e3ODR8: Downloading webpage
Traceback (most recent call last):
  File "youtube_dlc\__main__.py", line 19, in <module>
  File "youtube_dlc\__init__.py", line 487, in main
  File "youtube_dlc\__init__.py", line 477, in _real_main
  File "youtube_dlc\YoutubeDL.py", line 2103, in download
  File "youtube_dlc\YoutubeDL.py", line 830, in extract_info
  File "youtube_dlc\extractor\common.py", line 532, in extract
  File "youtube_dlc\extractor\youtube.py", line 1940, in _real_extract
AttributeError: 'NoneType' object has no attribute 'get'
[17752] Failed to execute script __main__

Probably should return something like this instead:

ERROR: Video unavailable. This video is private
pukkandan commented 3 years ago

It is not just private videos. Any youtube url without an actual video returns the same error. Eg: https://www.youtube.com/watch?v=aaaaaaaaaaa

Just adding a

if ytplayer_config is None:
    raise ExtractorError('Video is unavailable', expected=True)

will give a proper error message. But I don't know how to distinguish Private, wrong URL, deleted etc.

pukkandan commented 3 years ago

Related: #145