diff --git a/Changelog.md b/Changelog.md index d07544eb0..866fa1315 100644 --- a/Changelog.md +++ b/Changelog.md @@ -27,7 +27,7 @@ * 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.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 diff --git a/README.md b/README.md index 999d9f39d..42609fa2a 100644 --- a/README.md +++ b/README.md @@ -672,7 +672,7 @@ Then simply run `make`. You can also run `make yt-dlp` instead to compile only t --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 @@ The `-o` option is used to indicate a template for the output file names while ` **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 @@ Available for the media that is a track or a part of a music album: - `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 @@ youtube-dl_test_video_.mp4 # A simple file name # 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 @@ You can change the criteria for being considered the `best` by using `-S` (`--fo - `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. diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 72e6059ea..d1b6b2056 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2591,7 +2591,7 @@ class YoutubeDL(object): 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 @@ class YoutubeDL(object): 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) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 4205a3f8c..60db92204 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -1398,7 +1398,7 @@ class InfoExtractor(object): return self._hidden_inputs(form) class FormatSort: - regex = r' *((?P\+)?(?P[a-zA-Z0-9_]+)((?P[~:])(?P.*?))?)? *$' + regex = r' *((?P\+)?(?P[a-zA-Z0-9_]+)((?P[~:])(?P.*?))?)? *$' default = ('hidden', 'hasvid', 'ie_pref', 'lang', 'quality', 'res', 'fps', 'codec:vp9.2', 'size', 'br', 'asr', @@ -1558,7 +1558,7 @@ class InfoExtractor(object): 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 diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index e2f504ed9..794f51bb6 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -15,7 +15,6 @@ from .common import InfoExtractor, SearchInfoExtractor from ..compat import ( compat_chr, compat_HTTPError, - compat_kwargs, compat_parse_qs, compat_str, compat_urllib_parse_unquote_plus, diff --git a/yt_dlp/options.py b/yt_dlp/options.py index 95ef27e26..2047ac28e 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -1148,7 +1148,7 @@ def parseOpts(overrideArguments=None): 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 '