Skip to content

Conversation

@Adamvalade
Copy link

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Explanation of your pull request in arbitrary form goes here. Please make sure the description explains the purpose and effect of your pull request and is worded well enough to be understood. Provide as much context and examples as possible.

@dirkf
Copy link
Contributor

dirkf commented Oct 7, 2025

  1. Complete the template.
  2. Let's make it more like yt-dlp as below, first reverting your proposed changes:
--- old/youtube-dl/youtube_dl/extractor/common.py
+++ new/youtube-dl/youtube_dl/extractor/common.py
@@ -568,6 +568,11 @@
             for _ in range(2):
                 try:
                     self.initialize()
+                    self.report_extraction(
+                        None,
+                        url if self.get_param('verbose') or len(url) < 83
+                        else '...'.join((url[:60], url[-20:])),
+                        what='URL:')
                     ie_result = self._real_extract(url)
                     if self._x_forwarded_for_ip:
                         ie_result['__x_forwarded_for_ip'] = self._x_forwarded_for_ip
@@ -998,9 +1003,13 @@
     def report_drm(self, video_id):
         self.raise_no_formats('This video is DRM protected', expected=True, video_id=video_id)
 
-    def report_extraction(self, id_or_name):
+    def report_extraction(self, id_or_name, *more, **kw_what):
         """Report information extraction."""
+        what = kw_what.get('what', 'information')
+
-        self.to_screen('%s: Extracting information' % id_or_name)
+        self.to_screen(join_nonempty(
+            None if id_or_name is None else ('%s:' % (id_or_name,)),
+            'Extracting', what, *more, delim=' '))
 
     def report_download_webpage(self, video_id):
         """Report webpage download."""

To make a Py3 signature like fn(arg1, arg2, *more_args, opt_arg=DEFAULT), we can re-order the args, like fn(arg1, arg2, opt_arg=DEFAULT, *more_args), which is acceptable from 2.6 to 3.13+. But in fn(arg1, arg2, *args, opt_arg=DEFAULT), opt_arg must either be a kwarg or absent, and that isn't captured by the re-ordered signature. Instead, write fn(arg1, arg2, *args, **kw_opt_arg) and then opt_arg = kw_opt_arg.get('opt_arg', DEFAULT).

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

Successfully merging this pull request may close these issues.

2 participants