]> jfr.im git - yt-dlp.git/commitdiff
[cleanup] linter, code formatting and readme
authorpukkandan <redacted>
Tue, 18 May 2021 18:20:59 +0000 (23:50 +0530)
committerpukkandan <redacted>
Wed, 19 May 2021 11:18:20 +0000 (16:48 +0530)
README.md
yt_dlp/YoutubeDL.py
yt_dlp/extractor/common.py
yt_dlp/extractor/youtube.py
ytdlp_plugins/extractor/__init__.py
ytdlp_plugins/extractor/sample.py

index 940b61c8e7d417ab3fe4fb2e1c90284c1d0eeb84..e1022da37fa5a59de4841f757f366c4b4009b9a3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -168,7 +168,7 @@ ### DEPENDENCIES
 
 On windows, [Microsoft Visual C++ 2010 Redistributable Package (x86)](https://www.microsoft.com/en-us/download/details.aspx?id=26999) is also necessary to run yt-dlp. You probably already have this, but if the executable throws an error due to missing `MSVCR100.dll` you need to install it.
 
-Although there are no other required dependencies, `ffmpeg` and `ffprobe` are highly recommended. Other optional dependencies are `sponskrub`, `AtomicParsley`, `mutagen`, `pycryptodome` and any of the supported external downloaders. Note that the windows releases are already built with the python interpreter, mutagen and pycryptodome included.
+Although there are no other required dependencies, `ffmpeg` and `ffprobe` are highly recommended. Other optional dependencies are `sponskrub`, `AtomicParsley`, `mutagen`, `pycryptodome`, `phantomjs` and any of the supported external downloaders. Note that the windows releases are already built with the python interpreter, mutagen and pycryptodome included.
 
 ### UPDATE
 You can use `yt-dlp -U` to update if you are using the provided release.
@@ -818,7 +818,7 @@ # CONFIGURATION
     * `~/yt-dlp.conf.txt`
 
     Note that `~` points to `C:\Users\<user name>` on windows. Also, `%XDG_CONFIG_HOME%` defaults to `~/.config` if undefined
-1. **System Configuration**: `/etc/yt-dlp.conf` or `/etc/yt-dlp.conf`
+1. **System Configuration**: `/etc/yt-dlp.conf`
 
 For example, with the following configuration file yt-dlp will always extract the audio, not copy the mtime, use a proxy and save all videos under `YouTube` directory in your home directory:
 ```
index 55bc49a9ea3702dbfe7cc6da0aa15ffff41e3885..3f4885cfde140f06dc6cced8abe20ad758d6ef79 100644 (file)
@@ -1191,10 +1191,10 @@ def process_ie_result(self, ie_result, download=True, extra_info={}):
         elif result_type == 'url':
             # We have to add extra_info to the results because it may be
             # contained in a playlist
-            return self.extract_info(ie_result['url'],
-                                     download,
-                                     ie_key=ie_result.get('ie_key'),
-                                     extra_info=extra_info)
+            return self.extract_info(
+                ie_result['url'], download,
+                ie_key=ie_result.get('ie_key'),
+                extra_info=extra_info)
         elif result_type == 'url_transparent':
             # Use the information from the embedding page
             info = self.extract_info(
@@ -2136,12 +2136,9 @@ def is_wellformed(f):
                 self.report_warning('Requested format is not available')
         elif download:
             self.to_screen(
-                '[info] %s: Downloading format(s) %s'
-                % (info_dict['id'], ", ".join([f['format_id'] for f in formats_to_download])))
-            if len(formats_to_download) > 1:
-                self.to_screen(
-                    '[info] %s: Downloading video in %s formats'
-                    % (info_dict['id'], len(formats_to_download)))
+                '[info] %s: Downloading %d format(s): %s' % (
+                    info_dict['id'], len(formats_to_download),
+                    ", ".join([f['format_id'] for f in formats_to_download])))
             for fmt in formats_to_download:
                 new_info = dict(info_dict)
                 new_info.update(fmt)
@@ -2790,13 +2787,9 @@ def actual_post_extract(info_dict):
                     actual_post_extract(video_dict or {})
                 return
 
-            if '__post_extractor' not in info_dict:
-                return
-            post_extractor = info_dict['__post_extractor']
-            if post_extractor:
-                info_dict.update(post_extractor().items())
-            del info_dict['__post_extractor']
-            return
+            post_extractor = info_dict.get('__post_extractor') or (lambda: {})
+            info_dict.update(post_extractor().items())
+            info_dict.pop('__post_extractor', None)
 
         actual_post_extract(info_dict or {})
 
index 42824182f0ee2921bb5f0f2a813808fcea449cdb..3b2bda0e752d871f69459a89fc3bf8546e4cb261 100644 (file)
@@ -554,6 +554,8 @@ def extract(self, url):
                     self.initialize()
                     self.write_debug('Extracting URL: %s' % url)
                     ie_result = self._real_extract(url)
+                    if ie_result is None:
+                        return None
                     if self._x_forwarded_for_ip:
                         ie_result['__x_forwarded_for_ip'] = self._x_forwarded_for_ip
                     subtitles = ie_result.get('subtitles')
index 145b89a6eca7b492a7d6c3d63d8f7f1ada4f67ca..4ffb90cb97e961823bf7b3b707f120af5d541a78 100644 (file)
@@ -3636,7 +3636,7 @@ def __real_extract(self, url, smuggled_data):
 
         def get_mobj(url):
             mobj = self._url_re.match(url).groupdict()
-            mobj.update((k, '') for k,v in mobj.items() if v is None)
+            mobj.update((k, '') for k, v in mobj.items() if v is None)
             return mobj
 
         mobj = get_mobj(url)
index e1a83b909d29beaca0e891a913dc440512890ad8..92f2bfd861160065cefe8857a2ff22864d80a3d3 100644 (file)
@@ -1,2 +1,3 @@
 # flake8: noqa
+
 from .sample import SamplePluginIE
index 5d8df1df50487615eaeb6e5564edcf59ce4a9e75..99a384140941a5e9fba5b9ee540b8e12928a15c1 100644 (file)
@@ -1,11 +1,13 @@
+# coding: utf-8
+
 from __future__ import unicode_literals
 
-# Don't use relative imports
+# âš  Don't use relative imports
 from yt_dlp.extractor.common import InfoExtractor
 
 
-# See https://github.com/ytdl-org/youtube-dl#adding-support-for-a-new-site
-# for instuctions on making extractors
+# â„šī¸ Instructions on making extractors can be found at:
+# đŸ”— https://github.com/ytdl-org/youtube-dl#adding-support-for-a-new-site
 
 class SamplePluginIE(InfoExtractor):
     _WORKING = False