]> jfr.im git - yt-dlp.git/commitdiff
Fix some typos and linter
authorpukkandan <redacted>
Thu, 1 Apr 2021 08:46:10 +0000 (14:16 +0530)
committerpukkandan <redacted>
Thu, 1 Apr 2021 08:46:10 +0000 (14:16 +0530)
Changelog.md
README.md
yt_dlp/YoutubeDL.py
yt_dlp/extractor/common.py
yt_dlp/extractor/youtube.py
yt_dlp/options.py

index d07544eb07c512be23379906ff8ab50459e6f07a..866fa13153cc55dc8ec6ab91dacf326a777e3176 100644 (file)
@@ -27,7 +27,7 @@ ### 2021.03.24
 * Ability to load playlist infojson using `--load-info-json`
 * Write current epoch to infojson when using `--no-clean-infojson`
 * [youtube_live_chat] fix bug when trying to set cookies
-* [niconico] Fix for when logged in by: [CXwudi](https://github.com/CXwudi) and [xtkoba](https://github.com/xtkoba)
+* [niconico] Fix for when logged in by [CXwudi](https://github.com/CXwudi) and [xtkoba](https://github.com/xtkoba)
 * [linuxacadamy] Fix login
 
 
@@ -357,7 +357,7 @@ ### 2021.01.09
 
 ### 2021.01.08
 * Merge youtube-dl: Upto [2021.01.08](https://github.com/ytdl-org/youtube-dl/releases/tag/2021.01.08) except stitcher ([1](https://github.com/ytdl-org/youtube-dl/commit/bb38a1215718cdf36d73ff0a7830a64cd9fa37cc), [2](https://github.com/ytdl-org/youtube-dl/commit/a563c97c5cddf55f8989ed7ea8314ef78e30107f))
-* Moved changelog to seperate file
+* Moved changelog to separate file
 
 
 ### 2021.01.07-1
index 999d9f39db9d59469b05ad1c7bddf84e54e91d00..42609fa2ae403f9c7858cbb3d4b8c9b2ff0c5ead 100644 (file)
--- a/README.md
+++ b/README.md
@@ -672,7 +672,7 @@ ## Post-Processing Options:
     --parse-metadata FIELD:FORMAT    Parse additional metadata like title/artist
                                      from other fields. Give a template or field
                                      name to extract data from and the format to
-                                     interpret it as, seperated by a ":". Either
+                                     interpret it as, separated by a ":". Either
                                      regular expression with named capture
                                      groups or a similar syntax to the output
                                      template can be used for the FORMAT.
@@ -828,9 +828,9 @@ # OUTPUT TEMPLATE
 
 **tl;dr:** [navigate me to examples](#output-template-examples).
 
-The basic usage of `-o` is not to set any template arguments when downloading a single file, like in `yt-dlp -o funny_video.flv "https://some/video"` (hard-coding file extension like this is not recommended). However, it may contain special sequences that will be replaced when downloading each video. The special sequences may be formatted according to [python string formatting operations](https://docs.python.org/2/library/stdtypes.html#string-formatting). For example, `%(NAME)s` or `%(NAME)05d`. To clarify, that is a percent symbol followed by a name in parentheses, followed by formatting operations. Date/time fields can also be formatted according to [strftime formatting](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) by specifying it inside the parantheses seperated from the field name using a `>`. For example, `%(duration>%H-%M-%S)s`.
+The basic usage of `-o` is not to set any template arguments when downloading a single file, like in `yt-dlp -o funny_video.flv "https://some/video"` (hard-coding file extension like this is not recommended). However, it may contain special sequences that will be replaced when downloading each video. The special sequences may be formatted according to [python string formatting operations](https://docs.python.org/2/library/stdtypes.html#string-formatting). For example, `%(NAME)s` or `%(NAME)05d`. To clarify, that is a percent symbol followed by a name in parentheses, followed by formatting operations. Date/time fields can also be formatted according to [strftime formatting](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) by specifying it inside the parantheses separated from the field name using a `>`. For example, `%(duration>%H-%M-%S)s`.
 
-Additionally, you can set different output templates for the various metadata files seperately from the general output template by specifying the type of file followed by the template seperated by a colon ":". The different filetypes supported are `subtitle`, `thumbnail`, `description`, `annotation`, `infojson`, `pl_description`, `pl_infojson`, `chapter`. For example, `-o '%(title)s.%(ext)s' -o 'thumbnail:%(title)s\%(title)s.%(ext)s'`  will put the thumbnails in a folder with the same name as the video.
+Additionally, you can set different output templates for the various metadata files separately from the general output template by specifying the type of file followed by the template separated by a colon ":". The different filetypes supported are `subtitle`, `thumbnail`, `description`, `annotation`, `infojson`, `pl_description`, `pl_infojson`, `chapter`. For example, `-o '%(title)s.%(ext)s' -o 'thumbnail:%(title)s\%(title)s.%(ext)s'`  will put the thumbnails in a folder with the same name as the video.
 
 The available fields are:
 
@@ -923,7 +923,7 @@ # OUTPUT TEMPLATE
  - `disc_number` (numeric): Number of the disc or other physical medium the track belongs to
  - `release_year` (numeric): Year (YYYY) when the album was released
 
-Available when using `--split-chapters` for videos with internal chapters:
+Available for `chapter:` prefix when using `--split-chapters` for videos with internal chapters:
 
  - `section_title` (string): Title of the chapter
  - `section_number` (numeric): Number of the chapter within the file
@@ -962,7 +962,7 @@ #### Output template examples
 # Download YouTube playlist videos in separate directory indexed by video order in a playlist
 $ yt-dlp -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
 
-# Download YouTube playlist videos in seperate directories according to their uploaded year
+# Download YouTube playlist videos in separate directories according to their uploaded year
 $ yt-dlp -o '%(upload_date>%Y)s/%(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
 
 # Download all playlists of YouTube channel/user keeping each playlist in separate directory:
@@ -1078,7 +1078,7 @@ ## Sorting Formats
  - `br`: Equivalent to using `tbr,vbr,abr`
  - `asr`: Audio sample rate in Hz
 
-Note that any other **numerical** field made available by the extractor can also be used. All fields, unless specified otherwise, are sorted in decending order. To reverse this, prefix the field with a `+`. Eg: `+res` prefers format with the smallest resolution. Additionally, you can suffix a prefered value for the fields, seperated by a `:`. Eg: `res:720` prefers larger videos, but no larger than 720p and the smallest video if there are no videos less than 720p. For `codec` and `ext`, you can provide two prefered values, the first for video and the second for audio. Eg: `+codec:avc:m4a` (equivalent to `+vcodec:avc,+acodec:m4a`) sets the video codec preference to `h264` > `h265` > `vp9` > `vp9.2` > `av01` > `vp8` > `h263` > `theora` and audio codec preference to `mp4a` > `aac` > `vorbis` > `opus` > `mp3` > `ac3` > `dts`. You can also make the sorting prefer the nearest values to the provided by using `~` as the delimiter. Eg: `filesize~1G` prefers the format with filesize closest to 1 GiB.
+Note that any other **numerical** field made available by the extractor can also be used. All fields, unless specified otherwise, are sorted in decending order. To reverse this, prefix the field with a `+`. Eg: `+res` prefers format with the smallest resolution. Additionally, you can suffix a prefered value for the fields, separated by a `:`. Eg: `res:720` prefers larger videos, but no larger than 720p and the smallest video if there are no videos less than 720p. For `codec` and `ext`, you can provide two prefered values, the first for video and the second for audio. Eg: `+codec:avc:m4a` (equivalent to `+vcodec:avc,+acodec:m4a`) sets the video codec preference to `h264` > `h265` > `vp9` > `vp9.2` > `av01` > `vp8` > `h263` > `theora` and audio codec preference to `mp4a` > `aac` > `vorbis` > `opus` > `mp3` > `ac3` > `dts`. You can also make the sorting prefer the nearest values to the provided by using `~` as the delimiter. Eg: `filesize~1G` prefers the format with filesize closest to 1 GiB.
 
 The fields `hasvid`, `ie_pref`, `lang` are always given highest priority in sorting, irrespective of the user-defined order. This behaviour can be changed by using `--force-format-sort`. Apart from these, the default order used is: `quality,res,fps,codec:vp9.2,size,br,asr,proto,ext,hasaud,source,id`. Note that the extractors may override this default order, but they cannot override the user-provided order.
 
index 72e6059ea5ee1f8d060801f4b972c3838dac447c..d1b6b2056d3e3972031663f982a4b4a9aec8b598 100644 (file)
@@ -2591,7 +2591,7 @@ def post_extract(info_dict):
         def actual_post_extract(info_dict):
             if info_dict.get('_type') in ('playlist', 'multi_video'):
                 for video_dict in info_dict.get('entries', {}):
-                    actual_post_extract(video_dict)
+                    actual_post_extract(video_dict or {})
                 return
 
             if '__post_extractor' not in info_dict:
@@ -2602,7 +2602,7 @@ def actual_post_extract(info_dict):
             del info_dict['__post_extractor']
             return
 
-        actual_post_extract(info_dict)
+        actual_post_extract(info_dict or {})
 
     def pre_process(self, ie_info):
         info = dict(ie_info)
index 4205a3f8c0112c30a8ec40f59f59c5b5260508c0..60db9220486407caca1a58d00df5f40972b734e8 100644 (file)
@@ -1398,7 +1398,7 @@ def _form_hidden_inputs(self, form_id, html):
         return self._hidden_inputs(form)
 
     class FormatSort:
-        regex = r' *((?P<reverse>\+)?(?P<field>[a-zA-Z0-9_]+)((?P<seperator>[~:])(?P<limit>.*?))?)? *$'
+        regex = r' *((?P<reverse>\+)?(?P<field>[a-zA-Z0-9_]+)((?P<separator>[~:])(?P<limit>.*?))?)? *$'
 
         default = ('hidden', 'hasvid', 'ie_pref', 'lang', 'quality',
                    'res', 'fps', 'codec:vp9.2', 'size', 'br', 'asr',
@@ -1558,7 +1558,7 @@ def add_item(field, reverse, closest, limit_text):
                 if self._get_field_setting(field, 'type') == 'alias':
                     field = self._get_field_setting(field, 'field')
                 reverse = match.group('reverse') is not None
-                closest = match.group('seperator') == '~'
+                closest = match.group('separator') == '~'
                 limit_text = match.group('limit')
 
                 has_limit = limit_text is not None
index e2f504ed964d18c8b59d5273e07f009f14f46f36..794f51bb6cd3618919dff2a3c707dd436166a034 100644 (file)
@@ -15,7 +15,6 @@
 from ..compat import (
     compat_chr,
     compat_HTTPError,
-    compat_kwargs,
     compat_parse_qs,
     compat_str,
     compat_urllib_parse_unquote_plus,
index 95ef27e26adbc9b60093582eb3da90db87313879..2047ac28e14f8a37bef0d980dfe0bae864662e2b 100644 (file)
@@ -1148,7 +1148,7 @@ def _dict_from_multiple_values_options_callback(
         help=(
             'Parse additional metadata like title/artist from other fields. '
             'Give a template or field name to extract data from and the '
-            'format to interpret it as, seperated by a ":". '
+            'format to interpret it as, separated by a ":". '
             'Either regular expression with named capture groups or a '
             'similar syntax to the output template can be used for the FORMAT. '
             'Similarly, the syntax for output template can be used for FIELD '