blackjack4494 / yt-dlc

media downloader and library for various sites.
The Unlicense
2.91k stars 366 forks source link

Show URL in server error messages #155

Open axcore opened 3 years ago

axcore commented 3 years ago

Tartube is a GUI for youtube-dl(c). It has two modes of operation: download videos, or fetch a list of videos.

When we fetch a list of videos, Tartube uses the option --dump-json. youtube-dl(c) dumps the JSON to STDOUT, and Tartube interprets it.

Here is the problem. When we fetch a list of videos from a channel or playlist, it is impossible to know which video produces the error messages. Tartube is forced to mark the whole channel or playlist as broken, which is very confusing for users.

I think there are three solutions:

  1. Do nothing, Tartube remains broken forever
  2. When the extractor raises an exception, show the URL in STDOUT. This is a one-line fix in YoutubeDL.extract_info() EDIT: .__handle_extraction_exceptions():
    self.report_error('%s: %s' % (url, compat_str(e)), e.format_traceback())

The before and after error messages:

ERROR: This video requires payment to watch. ERROR: https://www.youtube.com/watch?v=jXdnHUwIMs4: This video requires payment to watch.

  1. Add a new command-line option, perhaps something like --dump-error-url. When an extractor exception is raised, the URL is not added to the YoutubeDL.report_error() call above, unless --dump-error-url was specified.

If you think #3 is a good solution, then I can provide code in a pull request.

blackjack4494 commented 3 years ago

Yes you are right. Someone already requested this and I had some solution for it but simply forgot it somehow (lots of things were going on at once back then).
Tho I don't know if it's good to return the url. Usually the id is returned in most cases.

axcore commented 3 years ago

Some error messages already include the video ID, but many don't. I could work with either the ID or the URL, or both.