mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 17:11:03 +01:00
parent
8f53dc44a0
commit
62b58c0936
@ -195,7 +195,7 @@ ## Adding support for a new site
|
|||||||
# * A value
|
# * A value
|
||||||
# * MD5 checksum; start the string with md5:
|
# * MD5 checksum; start the string with md5:
|
||||||
# * A regular expression; start the string with re:
|
# * A regular expression; start the string with re:
|
||||||
# * Any Python type (for example int or float)
|
# * Any Python type, e.g. int or float
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ ### Mandatory and optional metafields
|
|||||||
|
|
||||||
For pornographic sites, appropriate `age_limit` must also be returned.
|
For pornographic sites, appropriate `age_limit` must also be returned.
|
||||||
|
|
||||||
The extractor is allowed to return the info dict without url or formats in some special cases if it allows the user to extract usefull information with `--ignore-no-formats-error` - Eg: when the video is a live stream that has not started yet.
|
The extractor is allowed to return the info dict without url or formats in some special cases if it allows the user to extract usefull information with `--ignore-no-formats-error` - e.g. when the video is a live stream that has not started yet.
|
||||||
|
|
||||||
[Any field](yt_dlp/extractor/common.py#219-L426) apart from the aforementioned ones are considered **optional**. That means that extraction should be **tolerant** to situations when sources for these fields can potentially be unavailable (even if they are always available at the moment) and **future-proof** in order not to break the extraction of general purpose mandatory fields.
|
[Any field](yt_dlp/extractor/common.py#219-L426) apart from the aforementioned ones are considered **optional**. That means that extraction should be **tolerant** to situations when sources for these fields can potentially be unavailable (even if they are always available at the moment) and **future-proof** in order not to break the extraction of general purpose mandatory fields.
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ ### 2022.06.22
|
|||||||
|
|
||||||
* [**Deprecate support for Python 3.6**](https://github.com/yt-dlp/yt-dlp/issues/3764#issuecomment-1154051119)
|
* [**Deprecate support for Python 3.6**](https://github.com/yt-dlp/yt-dlp/issues/3764#issuecomment-1154051119)
|
||||||
* **Add option `--download-sections` to download video partially**
|
* **Add option `--download-sections` to download video partially**
|
||||||
* Chapter regex and time ranges are accepted (Eg: `--download-sections *1:10-2:20`)
|
* Chapter regex and time ranges are accepted, e.g. `--download-sections *1:10-2:20`
|
||||||
* Add option `--alias`
|
* Add option `--alias`
|
||||||
* Add option `--lazy-playlist` to process entries as they are received
|
* Add option `--lazy-playlist` to process entries as they are received
|
||||||
* Add option `--retry-sleep`
|
* Add option `--retry-sleep`
|
||||||
@ -1375,7 +1375,7 @@ ### 2021.09.25
|
|||||||
|
|
||||||
* Add new option `--netrc-location`
|
* Add new option `--netrc-location`
|
||||||
* [outtmpl] Allow alternate fields using `,`
|
* [outtmpl] Allow alternate fields using `,`
|
||||||
* [outtmpl] Add format type `B` to treat the value as bytes (eg: to limit the filename to a certain number of bytes)
|
* [outtmpl] Add format type `B` to treat the value as bytes, e.g. to limit the filename to a certain number of bytes
|
||||||
* Separate the options `--ignore-errors` and `--no-abort-on-error`
|
* Separate the options `--ignore-errors` and `--no-abort-on-error`
|
||||||
* Basic framework for simultaneous download of multiple formats by [nao20010128nao](https://github.com/nao20010128nao)
|
* Basic framework for simultaneous download of multiple formats by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
* [17live] Add 17.live extractor by [nao20010128nao](https://github.com/nao20010128nao)
|
* [17live] Add 17.live extractor by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
@ -1765,7 +1765,7 @@ ### 2021.07.07
|
|||||||
|
|
||||||
* Merge youtube-dl: Upto [commit/a803582](https://github.com/ytdl-org/youtube-dl/commit/a8035827177d6b59aca03bd717acb6a9bdd75ada)
|
* Merge youtube-dl: Upto [commit/a803582](https://github.com/ytdl-org/youtube-dl/commit/a8035827177d6b59aca03bd717acb6a9bdd75ada)
|
||||||
* Add `--extractor-args` to pass some extractor-specific arguments. See [readme](https://github.com/yt-dlp/yt-dlp#extractor-arguments)
|
* Add `--extractor-args` to pass some extractor-specific arguments. See [readme](https://github.com/yt-dlp/yt-dlp#extractor-arguments)
|
||||||
* Add extractor option `skip` for `youtube`. Eg: `--extractor-args youtube:skip=hls,dash`
|
* Add extractor option `skip` for `youtube`, e.g. `--extractor-args youtube:skip=hls,dash`
|
||||||
* Deprecates `--youtube-skip-dash-manifest`, `--youtube-skip-hls-manifest`, `--youtube-include-dash-manifest`, `--youtube-include-hls-manifest`
|
* Deprecates `--youtube-skip-dash-manifest`, `--youtube-skip-hls-manifest`, `--youtube-include-dash-manifest`, `--youtube-include-hls-manifest`
|
||||||
* Allow `--list...` options to work with `--print`, `--quiet` and other `--list...` options
|
* Allow `--list...` options to work with `--print`, `--quiet` and other `--list...` options
|
||||||
* [youtube] Use `player` API for additional video extraction requests by [coletdjnz](https://github.com/coletdjnz)
|
* [youtube] Use `player` API for additional video extraction requests by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
137
README.md
137
README.md
@ -376,7 +376,7 @@ ## General Options:
|
|||||||
--extractor-descriptions Output descriptions of all supported
|
--extractor-descriptions Output descriptions of all supported
|
||||||
extractors and exit
|
extractors and exit
|
||||||
--force-generic-extractor Force extraction to use the generic extractor
|
--force-generic-extractor Force extraction to use the generic extractor
|
||||||
--default-search PREFIX Use this prefix for unqualified URLs. Eg:
|
--default-search PREFIX Use this prefix for unqualified URLs. E.g.
|
||||||
"gvsearch2:python" downloads two videos from
|
"gvsearch2:python" downloads two videos from
|
||||||
google videos for the search term "python".
|
google videos for the search term "python".
|
||||||
Use the value "auto" to let yt-dlp guess
|
Use the value "auto" to let yt-dlp guess
|
||||||
@ -425,7 +425,7 @@ ## General Options:
|
|||||||
an alias starts with a dash "-", it is
|
an alias starts with a dash "-", it is
|
||||||
prefixed with "--". Arguments are parsed
|
prefixed with "--". Arguments are parsed
|
||||||
according to the Python string formatting
|
according to the Python string formatting
|
||||||
mini-language. Eg: --alias get-audio,-X
|
mini-language. E.g. --alias get-audio,-X
|
||||||
"-S=aext:{0},abr -x --audio-format {0}"
|
"-S=aext:{0},abr -x --audio-format {0}"
|
||||||
creates options "--get-audio" and "-X" that
|
creates options "--get-audio" and "-X" that
|
||||||
takes an argument (ARG0) and expands to
|
takes an argument (ARG0) and expands to
|
||||||
@ -439,10 +439,10 @@ ## General Options:
|
|||||||
|
|
||||||
## Network Options:
|
## Network Options:
|
||||||
--proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. To
|
--proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. To
|
||||||
enable SOCKS proxy, specify a proper scheme.
|
enable SOCKS proxy, specify a proper scheme,
|
||||||
Eg: socks5://user:pass@127.0.0.1:1080/. Pass
|
e.g. socks5://user:pass@127.0.0.1:1080/.
|
||||||
in an empty string (--proxy "") for direct
|
Pass in an empty string (--proxy "") for
|
||||||
connection
|
direct connection
|
||||||
--socket-timeout SECONDS Time to wait before giving up, in seconds
|
--socket-timeout SECONDS Time to wait before giving up, in seconds
|
||||||
--source-address IP Client-side IP address to bind to
|
--source-address IP Client-side IP address to bind to
|
||||||
-4, --force-ipv4 Make all connections via IPv4
|
-4, --force-ipv4 Make all connections via IPv4
|
||||||
@ -471,17 +471,17 @@ ## Video Selection:
|
|||||||
compatibility, START-STOP is also supported.
|
compatibility, START-STOP is also supported.
|
||||||
Use negative indices to count from the right
|
Use negative indices to count from the right
|
||||||
and negative STEP to download in reverse
|
and negative STEP to download in reverse
|
||||||
order. Eg: "-I 1:3,7,-5::2" used on a
|
order. E.g. "-I 1:3,7,-5::2" used on a
|
||||||
playlist of size 15 will download the videos
|
playlist of size 15 will download the videos
|
||||||
at index 1,2,3,7,11,13,15
|
at index 1,2,3,7,11,13,15
|
||||||
--min-filesize SIZE Do not download any videos smaller than SIZE
|
--min-filesize SIZE Do not download any videos smaller than
|
||||||
(e.g. 50k or 44.6m)
|
SIZE, e.g. 50k or 44.6M
|
||||||
--max-filesize SIZE Do not download any videos larger than SIZE
|
--max-filesize SIZE Do not download any videos larger than SIZE,
|
||||||
(e.g. 50k or 44.6m)
|
e.g. 50k or 44.6M
|
||||||
--date DATE Download only videos uploaded on this date.
|
--date DATE Download only videos uploaded on this date.
|
||||||
The date can be "YYYYMMDD" or in the format
|
The date can be "YYYYMMDD" or in the format
|
||||||
[now|today|yesterday][-N[day|week|month|year]].
|
[now|today|yesterday][-N[day|week|month|year]].
|
||||||
Eg: --date today-2weeks
|
E.g. --date today-2weeks
|
||||||
--datebefore DATE Download only videos uploaded on or before
|
--datebefore DATE Download only videos uploaded on or before
|
||||||
this date. The date formats accepted is the
|
this date. The date formats accepted is the
|
||||||
same as --date
|
same as --date
|
||||||
@ -498,7 +498,7 @@ ## Video Selection:
|
|||||||
conditions. Use a "\" to escape "&" or
|
conditions. Use a "\" to escape "&" or
|
||||||
quotes if needed. If used multiple times,
|
quotes if needed. If used multiple times,
|
||||||
the filter matches if atleast one of the
|
the filter matches if atleast one of the
|
||||||
conditions are met. Eg: --match-filter
|
conditions are met. E.g. --match-filter
|
||||||
!is_live --match-filter "like_count>?100 &
|
!is_live --match-filter "like_count>?100 &
|
||||||
description~='(?i)\bcats \& dogs\b'" matches
|
description~='(?i)\bcats \& dogs\b'" matches
|
||||||
only videos that are not live OR those that
|
only videos that are not live OR those that
|
||||||
@ -536,11 +536,11 @@ ## Download Options:
|
|||||||
-N, --concurrent-fragments N Number of fragments of a dash/hlsnative
|
-N, --concurrent-fragments N Number of fragments of a dash/hlsnative
|
||||||
video that should be downloaded concurrently
|
video that should be downloaded concurrently
|
||||||
(default is 1)
|
(default is 1)
|
||||||
-r, --limit-rate RATE Maximum download rate in bytes per second
|
-r, --limit-rate RATE Maximum download rate in bytes per second,
|
||||||
(e.g. 50K or 4.2M)
|
e.g. 50K or 4.2M
|
||||||
--throttled-rate RATE Minimum download rate in bytes per second
|
--throttled-rate RATE Minimum download rate in bytes per second
|
||||||
below which throttling is assumed and the
|
below which throttling is assumed and the
|
||||||
video data is re-extracted (e.g. 100K)
|
video data is re-extracted, e.g. 100K
|
||||||
-R, --retries RETRIES Number of retries (default is 10), or
|
-R, --retries RETRIES Number of retries (default is 10), or
|
||||||
"infinite"
|
"infinite"
|
||||||
--file-access-retries RETRIES Number of times to retry on file access
|
--file-access-retries RETRIES Number of times to retry on file access
|
||||||
@ -554,7 +554,7 @@ ## Download Options:
|
|||||||
be a number, linear=START[:END[:STEP=1]] or
|
be a number, linear=START[:END[:STEP=1]] or
|
||||||
exp=START[:END[:BASE=2]]. This option can be
|
exp=START[:END[:BASE=2]]. This option can be
|
||||||
used multiple times to set the sleep for the
|
used multiple times to set the sleep for the
|
||||||
different retry types. Eg: --retry-sleep
|
different retry types, e.g. --retry-sleep
|
||||||
linear=1::2 --retry-sleep fragment:exp=1:20
|
linear=1::2 --retry-sleep fragment:exp=1:20
|
||||||
--skip-unavailable-fragments Skip unavailable fragments for DASH,
|
--skip-unavailable-fragments Skip unavailable fragments for DASH,
|
||||||
hlsnative and ISM downloads (default)
|
hlsnative and ISM downloads (default)
|
||||||
@ -566,14 +566,14 @@ ## Download Options:
|
|||||||
downloading is finished
|
downloading is finished
|
||||||
--no-keep-fragments Delete downloaded fragments after
|
--no-keep-fragments Delete downloaded fragments after
|
||||||
downloading is finished (default)
|
downloading is finished (default)
|
||||||
--buffer-size SIZE Size of download buffer (e.g. 1024 or 16K)
|
--buffer-size SIZE Size of download buffer, e.g. 1024 or 16K
|
||||||
(default is 1024)
|
(default is 1024)
|
||||||
--resize-buffer The buffer size is automatically resized
|
--resize-buffer The buffer size is automatically resized
|
||||||
from an initial value of --buffer-size
|
from an initial value of --buffer-size
|
||||||
(default)
|
(default)
|
||||||
--no-resize-buffer Do not automatically adjust the buffer size
|
--no-resize-buffer Do not automatically adjust the buffer size
|
||||||
--http-chunk-size SIZE Size of a chunk for chunk-based HTTP
|
--http-chunk-size SIZE Size of a chunk for chunk-based HTTP
|
||||||
downloading (e.g. 10485760 or 10M) (default
|
downloading, e.g. 10485760 or 10M (default
|
||||||
is disabled). May be useful for bypassing
|
is disabled). May be useful for bypassing
|
||||||
bandwidth throttling imposed by a webserver
|
bandwidth throttling imposed by a webserver
|
||||||
(experimental)
|
(experimental)
|
||||||
@ -598,10 +598,10 @@ ## Download Options:
|
|||||||
the given regular expression. Time ranges
|
the given regular expression. Time ranges
|
||||||
prefixed by a "*" can also be used in place
|
prefixed by a "*" can also be used in place
|
||||||
of chapters to download the specified range.
|
of chapters to download the specified range.
|
||||||
Eg: --download-sections "*10:15-15:00"
|
Needs ffmpeg. This option can be used
|
||||||
--download-sections "intro". Needs ffmpeg.
|
multiple times to download multiple
|
||||||
This option can be used multiple times to
|
sections, e.g. --download-sections
|
||||||
download multiple sections
|
"*10:15-15:00" --download-sections "intro"
|
||||||
--downloader [PROTO:]NAME Name or path of the external downloader to
|
--downloader [PROTO:]NAME Name or path of the external downloader to
|
||||||
use (optionally) prefixed by the protocols
|
use (optionally) prefixed by the protocols
|
||||||
(http, ftp, m3u8, dash, rstp, rtmp, mms) to
|
(http, ftp, m3u8, dash, rstp, rtmp, mms) to
|
||||||
@ -609,7 +609,7 @@ ## Download Options:
|
|||||||
aria2c, avconv, axel, curl, ffmpeg, httpie,
|
aria2c, avconv, axel, curl, ffmpeg, httpie,
|
||||||
wget. You can use this option multiple times
|
wget. You can use this option multiple times
|
||||||
to set different downloaders for different
|
to set different downloaders for different
|
||||||
protocols. For example, --downloader aria2c
|
protocols. E.g. --downloader aria2c
|
||||||
--downloader "dash,m3u8:native" will use
|
--downloader "dash,m3u8:native" will use
|
||||||
aria2c for http/ftp downloads, and the
|
aria2c for http/ftp downloads, and the
|
||||||
native downloader for dash/m3u8 downloads
|
native downloader for dash/m3u8 downloads
|
||||||
@ -791,7 +791,7 @@ ## Verbosity and Simulation Options:
|
|||||||
"postprocess:", or "postprocess-title:".
|
"postprocess:", or "postprocess-title:".
|
||||||
The video's fields are accessible under the
|
The video's fields are accessible under the
|
||||||
"info" key and the progress attributes are
|
"info" key and the progress attributes are
|
||||||
accessible under "progress" key. E.g.:
|
accessible under "progress" key. E.g.
|
||||||
--console-title --progress-template
|
--console-title --progress-template
|
||||||
"download-title:%(info.id)s-%(progress.eta)s"
|
"download-title:%(info.id)s-%(progress.eta)s"
|
||||||
-v, --verbose Print various debugging information
|
-v, --verbose Print various debugging information
|
||||||
@ -860,7 +860,7 @@ ## Video Format Options:
|
|||||||
-F, --list-formats List available formats of each video.
|
-F, --list-formats List available formats of each video.
|
||||||
Simulate unless --no-simulate is used
|
Simulate unless --no-simulate is used
|
||||||
--merge-output-format FORMAT Containers that may be used when merging
|
--merge-output-format FORMAT Containers that may be used when merging
|
||||||
formats, separated by "/" (Eg: "mp4/mkv").
|
formats, separated by "/", e.g. "mp4/mkv".
|
||||||
Ignored if no merge is required. (currently
|
Ignored if no merge is required. (currently
|
||||||
supported: avi, flv, mkv, mov, mp4, webm)
|
supported: avi, flv, mkv, mov, mp4, webm)
|
||||||
|
|
||||||
@ -874,13 +874,13 @@ ## Subtitle Options:
|
|||||||
--list-subs List available subtitles of each video.
|
--list-subs List available subtitles of each video.
|
||||||
Simulate unless --no-simulate is used
|
Simulate unless --no-simulate is used
|
||||||
--sub-format FORMAT Subtitle format; accepts formats preference,
|
--sub-format FORMAT Subtitle format; accepts formats preference,
|
||||||
Eg: "srt" or "ass/srt/best"
|
e.g. "srt" or "ass/srt/best"
|
||||||
--sub-langs LANGS Languages of the subtitles to download (can
|
--sub-langs LANGS Languages of the subtitles to download (can
|
||||||
be regex) or "all" separated by commas. (Eg:
|
be regex) or "all" separated by commas, e.g.
|
||||||
--sub-langs "en.*,ja") You can prefix the
|
--sub-langs "en.*,ja". You can prefix the
|
||||||
language code with a "-" to exclude it from
|
language code with a "-" to exclude it from
|
||||||
the requested languages. (Eg: --sub-langs
|
the requested languages, e.g. --sub-langs
|
||||||
all,-live_chat) Use --list-subs for a list
|
all,-live_chat. Use --list-subs for a list
|
||||||
of available language tags
|
of available language tags
|
||||||
|
|
||||||
## Authentication Options:
|
## Authentication Options:
|
||||||
@ -929,7 +929,7 @@ ## Post-Processing Options:
|
|||||||
m4a, mka, mp3, ogg, opus, vorbis, wav). If
|
m4a, mka, mp3, ogg, opus, vorbis, wav). If
|
||||||
target container does not support the
|
target container does not support the
|
||||||
video/audio codec, remuxing will fail. You
|
video/audio codec, remuxing will fail. You
|
||||||
can specify multiple rules; Eg.
|
can specify multiple rules; e.g.
|
||||||
"aac>m4a/mov>mp4/mkv" will remux aac to m4a,
|
"aac>m4a/mov>mp4/mkv" will remux aac to m4a,
|
||||||
mov to mp4 and anything else to mkv
|
mov to mp4 and anything else to mkv
|
||||||
--recode-video FORMAT Re-encode the video into another format if
|
--recode-video FORMAT Re-encode the video into another format if
|
||||||
@ -954,7 +954,7 @@ ## Post-Processing Options:
|
|||||||
for ffmpeg/ffprobe, "_i"/"_o" can be
|
for ffmpeg/ffprobe, "_i"/"_o" can be
|
||||||
appended to the prefix optionally followed
|
appended to the prefix optionally followed
|
||||||
by a number to pass the argument before the
|
by a number to pass the argument before the
|
||||||
specified input/output file. Eg: --ppa
|
specified input/output file, e.g. --ppa
|
||||||
"Merger+ffmpeg_i1:-v quiet". You can use
|
"Merger+ffmpeg_i1:-v quiet". You can use
|
||||||
this option multiple times to give different
|
this option multiple times to give different
|
||||||
arguments to different postprocessors.
|
arguments to different postprocessors.
|
||||||
@ -1081,7 +1081,7 @@ ## SponsorBlock Options:
|
|||||||
music_offtopic, poi_highlight, all and
|
music_offtopic, poi_highlight, all and
|
||||||
default (=all). You can prefix the category
|
default (=all). You can prefix the category
|
||||||
with a "-" to exclude it. See [1] for
|
with a "-" to exclude it. See [1] for
|
||||||
description of the categories. Eg:
|
description of the categories. E.g.
|
||||||
--sponsorblock-mark all,-preview
|
--sponsorblock-mark all,-preview
|
||||||
[1] https://wiki.sponsor.ajay.app/w/Segment_Categories
|
[1] https://wiki.sponsor.ajay.app/w/Segment_Categories
|
||||||
--sponsorblock-remove CATS SponsorBlock categories to be removed from
|
--sponsorblock-remove CATS SponsorBlock categories to be removed from
|
||||||
@ -1140,7 +1140,7 @@ # CONFIGURATION
|
|||||||
|
|
||||||
1. **System Configuration**: `/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:
|
E.g. 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:
|
||||||
```
|
```
|
||||||
# Lines starting with # are comments
|
# Lines starting with # are comments
|
||||||
|
|
||||||
@ -1178,7 +1178,7 @@ ### Authentication with `.netrc` file
|
|||||||
```
|
```
|
||||||
machine <extractor> login <username> password <password>
|
machine <extractor> login <username> password <password>
|
||||||
```
|
```
|
||||||
For example:
|
E.g.
|
||||||
```
|
```
|
||||||
machine youtube login myaccount@gmail.com password my_youtube_password
|
machine youtube login myaccount@gmail.com password my_youtube_password
|
||||||
machine twitch login my_twitch_account_name password my_twitch_password
|
machine twitch login my_twitch_account_name password my_twitch_password
|
||||||
@ -1197,32 +1197,32 @@ # OUTPUT TEMPLATE
|
|||||||
|
|
||||||
The simplest 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 and could break some post-processing).
|
The simplest 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 and could break some post-processing).
|
||||||
|
|
||||||
It may however also 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/3/library/stdtypes.html#printf-style-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.
|
It may however also 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/3/library/stdtypes.html#printf-style-string-formatting), e.g. `%(NAME)s` or `%(NAME)05d`. To clarify, that is a percent symbol followed by a name in parentheses, followed by formatting operations.
|
||||||
|
|
||||||
The field names themselves (the part inside the parenthesis) can also have some special formatting:
|
The field names themselves (the part inside the parenthesis) can also have some special formatting:
|
||||||
|
|
||||||
1. **Object traversal**: The dictionaries and lists available in metadata can be traversed by using a `.` (dot) separator. You can also do python slicing using `:`. Eg: `%(tags.0)s`, `%(subtitles.en.-1.ext)s`, `%(id.3:7:-1)s`, `%(formats.:.format_id)s`. `%()s` refers to the entire infodict. Note that all the fields that become available using this method are not listed below. Use `-j` to see such fields
|
1. **Object traversal**: The dictionaries and lists available in metadata can be traversed by using a `.` (dot) separator. You can also do python slicing using `:`. E.g. `%(tags.0)s`, `%(subtitles.en.-1.ext)s`, `%(id.3:7:-1)s`, `%(formats.:.format_id)s`. `%()s` refers to the entire infodict. Note that all the fields that become available using this method are not listed below. Use `-j` to see such fields
|
||||||
|
|
||||||
1. **Addition**: Addition and subtraction of numeric fields can be done using `+` and `-` respectively. Eg: `%(playlist_index+10)03d`, `%(n_entries+1-playlist_index)d`
|
1. **Addition**: Addition and subtraction of numeric fields can be done using `+` and `-` respectively. E.g. `%(playlist_index+10)03d`, `%(n_entries+1-playlist_index)d`
|
||||||
|
|
||||||
1. **Date/time Formatting**: Date/time fields can be formatted according to [strftime formatting](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) by specifying it separated from the field name using a `>`. Eg: `%(duration>%H-%M-%S)s`, `%(upload_date>%Y-%m-%d)s`, `%(epoch-3600>%H-%M-%S)s`
|
1. **Date/time Formatting**: Date/time fields can be formatted according to [strftime formatting](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) by specifying it separated from the field name using a `>`. E.g. `%(duration>%H-%M-%S)s`, `%(upload_date>%Y-%m-%d)s`, `%(epoch-3600>%H-%M-%S)s`
|
||||||
|
|
||||||
1. **Alternatives**: Alternate fields can be specified separated with a `,`. Eg: `%(release_date>%Y,upload_date>%Y|Unknown)s`
|
1. **Alternatives**: Alternate fields can be specified separated with a `,`. E.g. `%(release_date>%Y,upload_date>%Y|Unknown)s`
|
||||||
|
|
||||||
1. **Replacement**: A replacement value can specified using a `&` separator. If the field is *not* empty, this replacement value will be used instead of the actual field content. This is done after alternate fields are considered; thus the replacement is used if *any* of the alternative fields is *not* empty.
|
1. **Replacement**: A replacement value can specified using a `&` separator. If the field is *not* empty, this replacement value will be used instead of the actual field content. This is done after alternate fields are considered; thus the replacement is used if *any* of the alternative fields is *not* empty.
|
||||||
|
|
||||||
1. **Default**: A literal default value can be specified for when the field is empty using a `|` separator. This overrides `--output-na-template`. Eg: `%(uploader|Unknown)s`
|
1. **Default**: A literal default value can be specified for when the field is empty using a `|` separator. This overrides `--output-na-template`. E.g. `%(uploader|Unknown)s`
|
||||||
|
|
||||||
1. **More Conversions**: In addition to the normal format types `diouxXeEfFgGcrs`, yt-dlp additionally supports converting to `B` = **B**ytes, `j` = **j**son (flag `#` for pretty-printing), `h` = HTML escaping, `l` = a comma separated **l**ist (flag `#` for `\n` newline-separated), `q` = a string **q**uoted for the terminal (flag `#` to split a list into different arguments), `D` = add **D**ecimal suffixes (Eg: 10M) (flag `#` to use 1024 as factor), and `S` = **S**anitize as filename (flag `#` for restricted)
|
1. **More Conversions**: In addition to the normal format types `diouxXeEfFgGcrs`, yt-dlp additionally supports converting to `B` = **B**ytes, `j` = **j**son (flag `#` for pretty-printing), `h` = HTML escaping, `l` = a comma separated **l**ist (flag `#` for `\n` newline-separated), `q` = a string **q**uoted for the terminal (flag `#` to split a list into different arguments), `D` = add **D**ecimal suffixes (e.g. 10M) (flag `#` to use 1024 as factor), and `S` = **S**anitize as filename (flag `#` for restricted)
|
||||||
|
|
||||||
1. **Unicode normalization**: The format type `U` can be used for NFC [unicode normalization](https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize). The alternate form flag (`#`) changes the normalization to NFD and the conversion flag `+` can be used for NFKC/NFKD compatibility equivalence normalization. Eg: `%(title)+.100U` is NFKC
|
1. **Unicode normalization**: The format type `U` can be used for NFC [unicode normalization](https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize). The alternate form flag (`#`) changes the normalization to NFD and the conversion flag `+` can be used for NFKC/NFKD compatibility equivalence normalization. E.g. `%(title)+.100U` is NFKC
|
||||||
|
|
||||||
To summarize, the general syntax for a field is:
|
To summarize, the general syntax for a field is:
|
||||||
```
|
```
|
||||||
%(name[.keys][addition][>strf][,alternate][&replacement][|default])[flags][width][.precision][length]type
|
%(name[.keys][addition][>strf][,alternate][&replacement][|default])[flags][width][.precision][length]type
|
||||||
```
|
```
|
||||||
|
|
||||||
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 file types supported are `subtitle`, `thumbnail`, `description`, `annotation` (deprecated), `infojson`, `link`, `pl_thumbnail`, `pl_description`, `pl_infojson`, `chapter`, `pl_video`. 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. If any of the templates is empty, that type of file will not be written. Eg: `--write-thumbnail -o "thumbnail:"` will write thumbnails only for playlists and not for 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 file types supported are `subtitle`, `thumbnail`, `description`, `annotation` (deprecated), `infojson`, `link`, `pl_thumbnail`, `pl_description`, `pl_infojson`, `chapter`, `pl_video`. E.g. `-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. If any of the templates is empty, that type of file will not be written. E.g. `--write-thumbnail -o "thumbnail:"` will write thumbnails only for playlists and not for video.
|
||||||
|
|
||||||
The available fields are:
|
The available fields are:
|
||||||
|
|
||||||
@ -1358,13 +1358,13 @@ # OUTPUT TEMPLATE
|
|||||||
- `category_names` (list): Friendly names of the categories
|
- `category_names` (list): Friendly names of the categories
|
||||||
- `name` (string): Friendly name of the smallest category
|
- `name` (string): Friendly name of the smallest category
|
||||||
|
|
||||||
Each aforementioned sequence when referenced in an output template will be replaced by the actual value corresponding to the sequence name. For example for `-o %(title)s-%(id)s.%(ext)s` and an mp4 video with title `yt-dlp test video` and id `BaW_jenozKc`, this will result in a `yt-dlp test video-BaW_jenozKc.mp4` file created in the current directory.
|
Each aforementioned sequence when referenced in an output template will be replaced by the actual value corresponding to the sequence name. E.g. for `-o %(title)s-%(id)s.%(ext)s` and an mp4 video with title `yt-dlp test video` and id `BaW_jenozKc`, this will result in a `yt-dlp test video-BaW_jenozKc.mp4` file created in the current directory.
|
||||||
|
|
||||||
Note that some of the sequences are not guaranteed to be present since they depend on the metadata obtained by a particular extractor. Such sequences will be replaced with placeholder value provided with `--output-na-placeholder` (`NA` by default).
|
Note that some of the sequences are not guaranteed to be present since they depend on the metadata obtained by a particular extractor. Such sequences will be replaced with placeholder value provided with `--output-na-placeholder` (`NA` by default).
|
||||||
|
|
||||||
**Tip**: Look at the `-j` output to identify which fields are available for the particular URL
|
**Tip**: Look at the `-j` output to identify which fields are available for the particular URL
|
||||||
|
|
||||||
For numeric sequences you can use [numeric related formatting](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting), for example, `%(view_count)05d` will result in a string with view count padded with zeros up to 5 characters, like in `00042`.
|
For numeric sequences you can use [numeric related formatting](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting); e.g. `%(view_count)05d` will result in a string with view count padded with zeros up to 5 characters, like in `00042`.
|
||||||
|
|
||||||
Output templates can also contain arbitrary hierarchical path, e.g. `-o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"` which will result in downloading each video in a directory corresponding to this path template. Any missing directory will be automatically created for you.
|
Output templates can also contain arbitrary hierarchical path, e.g. `-o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"` which will result in downloading each video in a directory corresponding to this path template. Any missing directory will be automatically created for you.
|
||||||
|
|
||||||
@ -1434,7 +1434,7 @@ # FORMAT SELECTION
|
|||||||
**tl;dr:** [navigate me to examples](#format-selection-examples).
|
**tl;dr:** [navigate me to examples](#format-selection-examples).
|
||||||
<!-- MANPAGE: END EXCLUDED SECTION -->
|
<!-- MANPAGE: END EXCLUDED SECTION -->
|
||||||
|
|
||||||
The simplest case is requesting a specific format, for example with `-f 22` you can download the format with format code equal to 22. You can get the list of available format codes for particular video using `--list-formats` or `-F`. Note that these format codes are extractor specific.
|
The simplest case is requesting a specific format; e.g. with `-f 22` you can download the format with format code equal to 22. You can get the list of available format codes for particular video using `--list-formats` or `-F`. Note that these format codes are extractor specific.
|
||||||
|
|
||||||
You can also use a file extension (currently `3gp`, `aac`, `flv`, `m4a`, `mp3`, `mp4`, `ogg`, `wav`, `webm` are supported) to download the best quality format of a particular file extension served as a single file, e.g. `-f webm` will download the best quality format with the `webm` extension served as a single file.
|
You can also use a file extension (currently `3gp`, `aac`, `flv`, `m4a`, `mp3`, `mp4`, `ogg`, `wav`, `webm` are supported) to download the best quality format of a particular file extension served as a single file, e.g. `-f webm` will download the best quality format with the `webm` extension served as a single file.
|
||||||
|
|
||||||
@ -1461,15 +1461,15 @@ # FORMAT SELECTION
|
|||||||
|
|
||||||
You can select the n'th best format of a type by using `best<type>.<n>`. For example, `best.2` will select the 2nd best combined format. Similarly, `bv*.3` will select the 3rd best format that contains a video stream.
|
You can select the n'th best format of a type by using `best<type>.<n>`. For example, `best.2` will select the 2nd best combined format. Similarly, `bv*.3` will select the 3rd best format that contains a video stream.
|
||||||
|
|
||||||
If you want to download multiple videos and they don't have the same formats available, you can specify the order of preference using slashes. Note that formats on the left hand side are preferred, for example `-f 22/17/18` will download format 22 if it's available, otherwise it will download format 17 if it's available, otherwise it will download format 18 if it's available, otherwise it will complain that no suitable formats are available for download.
|
If you want to download multiple videos and they don't have the same formats available, you can specify the order of preference using slashes. Note that formats on the left hand side are preferred; e.g. `-f 22/17/18` will download format 22 if it's available, otherwise it will download format 17 if it's available, otherwise it will download format 18 if it's available, otherwise it will complain that no suitable formats are available for download.
|
||||||
|
|
||||||
If you want to download several formats of the same video use a comma as a separator, e.g. `-f 22,17,18` will download all these three formats, of course if they are available. Or a more sophisticated example combined with the precedence feature: `-f 136/137/mp4/bestvideo,140/m4a/bestaudio`.
|
If you want to download several formats of the same video use a comma as a separator, e.g. `-f 22,17,18` will download all these three formats, of course if they are available. Or a more sophisticated example combined with the precedence feature: `-f 136/137/mp4/bestvideo,140/m4a/bestaudio`.
|
||||||
|
|
||||||
You can merge the video and audio of multiple formats into a single file using `-f <format1>+<format2>+...` (requires ffmpeg installed), for example `-f bestvideo+bestaudio` will download the best video-only format, the best audio-only format and mux them together with ffmpeg.
|
You can merge the video and audio of multiple formats into a single file using `-f <format1>+<format2>+...` (requires ffmpeg installed); e.g. `-f bestvideo+bestaudio` will download the best video-only format, the best audio-only format and mux them together with ffmpeg.
|
||||||
|
|
||||||
**Deprecation warning**: Since the *below* described behavior is complex and counter-intuitive, this will be removed and multistreams will be enabled by default in the future. A new operator will be instead added to limit formats to single audio/video
|
**Deprecation warning**: Since the *below* described behavior is complex and counter-intuitive, this will be removed and multistreams will be enabled by default in the future. A new operator will be instead added to limit formats to single audio/video
|
||||||
|
|
||||||
Unless `--video-multistreams` is used, all formats with a video stream except the first one are ignored. Similarly, unless `--audio-multistreams` is used, all formats with an audio stream except the first one are ignored. For example, `-f bestvideo+best+bestaudio --video-multistreams --audio-multistreams` will download and merge all 3 given formats. The resulting file will have 2 video streams and 2 audio streams. But `-f bestvideo+best+bestaudio --no-video-multistreams` will download and merge only `bestvideo` and `bestaudio`. `best` is ignored since another format containing a video stream (`bestvideo`) has already been selected. The order of the formats is therefore important. `-f best+bestaudio --no-audio-multistreams` will download and merge both formats while `-f bestaudio+best --no-audio-multistreams` will ignore `best` and download only `bestaudio`.
|
Unless `--video-multistreams` is used, all formats with a video stream except the first one are ignored. Similarly, unless `--audio-multistreams` is used, all formats with an audio stream except the first one are ignored. E.g. `-f bestvideo+best+bestaudio --video-multistreams --audio-multistreams` will download and merge all 3 given formats. The resulting file will have 2 video streams and 2 audio streams. But `-f bestvideo+best+bestaudio --no-video-multistreams` will download and merge only `bestvideo` and `bestaudio`. `best` is ignored since another format containing a video stream (`bestvideo`) has already been selected. The order of the formats is therefore important. `-f best+bestaudio --no-audio-multistreams` will download and merge both formats while `-f bestaudio+best --no-audio-multistreams` will ignore `best` and download only `bestaudio`.
|
||||||
|
|
||||||
## Filtering Formats
|
## Filtering Formats
|
||||||
|
|
||||||
@ -1500,9 +1500,9 @@ ## Filtering Formats
|
|||||||
|
|
||||||
Note that none of the aforementioned meta fields are guaranteed to be present since this solely depends on the metadata obtained by particular extractor, i.e. the metadata offered by the website. Any other field made available by the extractor can also be used for filtering.
|
Note that none of the aforementioned meta fields are guaranteed to be present since this solely depends on the metadata obtained by particular extractor, i.e. the metadata offered by the website. Any other field made available by the extractor can also be used for filtering.
|
||||||
|
|
||||||
Formats for which the value is not known are excluded unless you put a question mark (`?`) after the operator. You can combine format filters, so `-f "[height<=?720][tbr>500]"` selects up to 720p videos (or videos where the height is not known) with a bitrate of at least 500 KBit/s. You can also use the filters with `all` to download all formats that satisfy the filter. For example, `-f "all[vcodec=none]"` selects all audio-only formats.
|
Formats for which the value is not known are excluded unless you put a question mark (`?`) after the operator. You can combine format filters, so `-f "[height<=?720][tbr>500]"` selects up to 720p videos (or videos where the height is not known) with a bitrate of at least 500 KBit/s. You can also use the filters with `all` to download all formats that satisfy the filter, e.g. `-f "all[vcodec=none]"` selects all audio-only formats.
|
||||||
|
|
||||||
Format selectors can also be grouped using parentheses, for example if you want to download the best pre-merged mp4 and webm formats with a height lower than 480 you can use `-f "(mp4,webm)[height<480]"`.
|
Format selectors can also be grouped using parentheses; e.g. `-f "(mp4,webm)[height<480]"` will download the best pre-merged mp4 and webm formats with a height lower than 480.
|
||||||
|
|
||||||
## Sorting Formats
|
## Sorting Formats
|
||||||
|
|
||||||
@ -1540,7 +1540,7 @@ ## Sorting Formats
|
|||||||
|
|
||||||
**Deprecation warning**: Many of these fields have (currently undocumented) aliases, that may be removed in a future version. It is recommended to use only the documented field names.
|
**Deprecation warning**: Many of these fields have (currently undocumented) aliases, that may be removed in a future version. It is recommended to use only the documented field names.
|
||||||
|
|
||||||
All fields, unless specified otherwise, are sorted in descending order. To reverse this, prefix the field with a `+`. Eg: `+res` prefers format with the smallest resolution. Additionally, you can suffix a preferred 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 preferred 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.
|
All fields, unless specified otherwise, are sorted in descending order. To reverse this, prefix the field with a `+`. E.g. `+res` prefers format with the smallest resolution. Additionally, you can suffix a preferred value for the fields, separated by a `:`. E.g. `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 preferred values, the first for video and the second for audio. E.g. `+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. E.g. `filesize~1G` prefers the format with filesize closest to 1 GiB.
|
||||||
|
|
||||||
The fields `hasvid` and `ie_pref` are always given highest priority in sorting, irrespective of the user-defined order. This behaviour can be changed by using `--format-sort-force`. Apart from these, the default order used is: `lang,quality,res,fps,hdr:12,vcodec:vp9.2,channels,acodec,size,br,asr,proto,ext,hasaud,source,id`. The extractors may override this default order, but they cannot override the user-provided order.
|
The fields `hasvid` and `ie_pref` are always given highest priority in sorting, irrespective of the user-defined order. This behaviour can be changed by using `--format-sort-force`. Apart from these, the default order used is: `lang,quality,res,fps,hdr:12,vcodec:vp9.2,channels,acodec,size,br,asr,proto,ext,hasaud,source,id`. The extractors may override this default order, but they cannot override the user-provided order.
|
||||||
|
|
||||||
@ -1685,9 +1685,9 @@ # MODIFYING METADATA
|
|||||||
|
|
||||||
This option also has a few special uses:
|
This option also has a few special uses:
|
||||||
|
|
||||||
* You can download an additional URL based on the metadata of the currently downloaded video. To do this, set the field `additional_urls` to the URL that you want to download. Eg: `--parse-metadata "description:(?P<additional_urls>https?://www\.vimeo\.com/\d+)` will download the first vimeo video found in the description
|
* You can download an additional URL based on the metadata of the currently downloaded video. To do this, set the field `additional_urls` to the URL that you want to download. E.g. `--parse-metadata "description:(?P<additional_urls>https?://www\.vimeo\.com/\d+)` will download the first vimeo video found in the description
|
||||||
|
|
||||||
* You can use this to change the metadata that is embedded in the media file. To do this, set the value of the corresponding field with a `meta_` prefix. For example, any value you set to `meta_description` field will be added to the `description` field in the file. For example, you can use this to set a different "description" and "synopsis". To modify the metadata of individual streams, use the `meta<n>_` prefix (Eg: `meta1_language`). Any value set to the `meta_` field will overwrite all default values.
|
* You can use this to change the metadata that is embedded in the media file. To do this, set the value of the corresponding field with a `meta_` prefix. For example, any value you set to `meta_description` field will be added to the `description` field in the file - you can use this to set a different "description" and "synopsis". To modify the metadata of individual streams, use the `meta<n>_` prefix (e.g. `meta1_language`). Any value set to the `meta_` field will overwrite all default values.
|
||||||
|
|
||||||
**Note**: Metadata modification happens before format selection, post-extraction and other post-processing operations. Some fields may be added or changed during these steps, overriding your changes.
|
**Note**: Metadata modification happens before format selection, post-extraction and other post-processing operations. Some fields may be added or changed during these steps, overriding your changes.
|
||||||
|
|
||||||
@ -1746,20 +1746,20 @@ # Replace all spaces and "_" in title and uploader with a `-`
|
|||||||
|
|
||||||
# EXTRACTOR ARGUMENTS
|
# EXTRACTOR ARGUMENTS
|
||||||
|
|
||||||
Some extractors accept additional arguments which can be passed using `--extractor-args KEY:ARGS`. `ARGS` is a `;` (semicolon) separated string of `ARG=VAL1,VAL2`. Eg: `--extractor-args "youtube:player-client=android_embedded,web;include_live_dash" --extractor-args "funimation:version=uncut"`
|
Some extractors accept additional arguments which can be passed using `--extractor-args KEY:ARGS`. `ARGS` is a `;` (semicolon) separated string of `ARG=VAL1,VAL2`. E.g. `--extractor-args "youtube:player-client=android_embedded,web;include_live_dash" --extractor-args "funimation:version=uncut"`
|
||||||
|
|
||||||
The following extractors use this feature:
|
The following extractors use this feature:
|
||||||
|
|
||||||
#### youtube
|
#### youtube
|
||||||
* `skip`: One or more of `hls`, `dash` or `translated_subs` to skip extraction of the m3u8 manifests, dash manifests and [auto-translated subtitles](https://github.com/yt-dlp/yt-dlp/issues/4090#issuecomment-1158102032) respectively
|
* `skip`: One or more of `hls`, `dash` or `translated_subs` to skip extraction of the m3u8 manifests, dash manifests and [auto-translated subtitles](https://github.com/yt-dlp/yt-dlp/issues/4090#issuecomment-1158102032) respectively
|
||||||
* `player_client`: Clients to extract video data from. The main clients are `web`, `android` and `ios` with variants `_music`, `_embedded`, `_embedscreen`, `_creator` (Eg: `web_embedded`); and `mweb` and `tv_embedded` (agegate bypass) with no variants. By default, `android,web` is used, but `tv_embedded` and `creator` variants are added as required for age-gated videos. Similarly the music variants are added for `music.youtube.com` urls. You can use `all` to use all the clients, and `default` for the default clients.
|
* `player_client`: Clients to extract video data from. The main clients are `web`, `android` and `ios` with variants `_music`, `_embedded`, `_embedscreen`, `_creator` (e.g. `web_embedded`); and `mweb` and `tv_embedded` (agegate bypass) with no variants. By default, `android,web` is used, but `tv_embedded` and `creator` variants are added as required for age-gated videos. Similarly the music variants are added for `music.youtube.com` urls. You can use `all` to use all the clients, and `default` for the default clients.
|
||||||
* `player_skip`: Skip some network requests that are generally needed for robust extraction. One or more of `configs` (skip client configs), `webpage` (skip initial webpage), `js` (skip js player). While these options can help reduce the number of requests needed or avoid some rate-limiting, they could cause some issues. See [#860](https://github.com/yt-dlp/yt-dlp/pull/860) for more details
|
* `player_skip`: Skip some network requests that are generally needed for robust extraction. One or more of `configs` (skip client configs), `webpage` (skip initial webpage), `js` (skip js player). While these options can help reduce the number of requests needed or avoid some rate-limiting, they could cause some issues. See [#860](https://github.com/yt-dlp/yt-dlp/pull/860) for more details
|
||||||
* `include_live_dash`: Include live dash formats even without `--live-from-start` (These formats don't download properly)
|
* `include_live_dash`: Include live dash formats even without `--live-from-start` (These formats don't download properly)
|
||||||
* `comment_sort`: `top` or `new` (default) - choose comment sorting mode (on YouTube's side)
|
* `comment_sort`: `top` or `new` (default) - choose comment sorting mode (on YouTube's side)
|
||||||
* `max_comments`: Limit the amount of comments to gather. Comma-separated list of integers representing `max-comments,max-parents,max-replies,max-replies-per-thread`. Default is `all,all,all,all`
|
* `max_comments`: Limit the amount of comments to gather. Comma-separated list of integers representing `max-comments,max-parents,max-replies,max-replies-per-thread`. Default is `all,all,all,all`
|
||||||
* E.g. `all,all,1000,10` will get a maximum of 1000 replies total, with up to 10 replies per thread. `1000,all,100` will get a maximum of 1000 comments, with a maximum of 100 replies total
|
* E.g. `all,all,1000,10` will get a maximum of 1000 replies total, with up to 10 replies per thread. `1000,all,100` will get a maximum of 1000 comments, with a maximum of 100 replies total
|
||||||
* `innertube_host`: Innertube API host to use for all API requests
|
* `innertube_host`: Innertube API host to use for all API requests
|
||||||
* e.g. `studio.youtube.com`, `youtubei.googleapis.com`
|
* E.g. `studio.youtube.com`, `youtubei.googleapis.com`
|
||||||
* Note: Cookies exported from `www.youtube.com` will not work with hosts other than `*.youtube.com`
|
* Note: Cookies exported from `www.youtube.com` will not work with hosts other than `*.youtube.com`
|
||||||
* `innertube_key`: Innertube API key to use for all API requests
|
* `innertube_key`: Innertube API key to use for all API requests
|
||||||
|
|
||||||
@ -1768,17 +1768,16 @@ #### youtubetab (YouTube playlists, channels, feeds, etc.)
|
|||||||
* `approximate_date`: Extract approximate `upload_date` in flat-playlist. This may cause date-based filters to be slightly off
|
* `approximate_date`: Extract approximate `upload_date` in flat-playlist. This may cause date-based filters to be slightly off
|
||||||
|
|
||||||
#### funimation
|
#### funimation
|
||||||
* `language`: Languages to extract. Eg: `funimation:language=english,japanese`
|
* `language`: Languages to extract, e.g. `funimation:language=english,japanese`
|
||||||
* `version`: The video version to extract - `uncut` or `simulcast`
|
* `version`: The video version to extract - `uncut` or `simulcast`
|
||||||
|
|
||||||
#### crunchyroll
|
#### crunchyroll
|
||||||
* `language`: Languages to extract. Eg: `crunchyroll:language=jaJp`
|
* `language`: Languages to extract, e.g. `crunchyroll:language=jaJp`
|
||||||
* `hardsub`: Which hard-sub versions to extract. Eg: `crunchyroll:hardsub=None,enUS`
|
* `hardsub`: Which hard-sub versions to extract, e.g. `crunchyroll:hardsub=None,enUS`
|
||||||
|
|
||||||
#### crunchyrollbeta
|
#### crunchyrollbeta
|
||||||
* `format`: Which stream type(s) to extract. Default is `adaptive_hls` Eg: `crunchyrollbeta:format=vo_adaptive_hls`
|
* `format`: Which stream type(s) to extract (default: `adaptive_hls`). Potentially useful values include `adaptive_hls`, `adaptive_dash`, `vo_adaptive_hls`, `vo_adaptive_dash`, `download_hls`, `download_dash`, `multitrack_adaptive_hls_v2`
|
||||||
* Potentially useful values include `adaptive_hls`, `adaptive_dash`, `vo_adaptive_hls`, `vo_adaptive_dash`, `download_hls`, `download_dash`, `multitrack_adaptive_hls_v2`
|
* `hardsub`: Preference order for which hardsub versions to extract (default: `None` = no hardsubs), e.g. `crunchyrollbeta:hardsub=en-US,None`
|
||||||
* `hardsub`: Preference order for which hardsub versions to extract. Default is `None` (no hardsubs). Eg: `crunchyrollbeta:hardsub=en-US,None`
|
|
||||||
|
|
||||||
#### vikichannel
|
#### vikichannel
|
||||||
* `video_types`: Types of videos to download - one or more of `episodes`, `movies`, `clips`, `trailers`
|
* `video_types`: Types of videos to download - one or more of `episodes`, `movies`, `clips`, `trailers`
|
||||||
@ -1798,11 +1797,11 @@ #### hotstar
|
|||||||
* `dr`: dynamic range to ignore - one or more of `sdr`, `hdr10`, `dv`
|
* `dr`: dynamic range to ignore - one or more of `sdr`, `hdr10`, `dv`
|
||||||
|
|
||||||
#### tiktok
|
#### tiktok
|
||||||
* `app_version`: App version to call mobile APIs with - should be set along with `manifest_app_version`. (e.g. `20.2.1`)
|
* `app_version`: App version to call mobile APIs with - should be set along with `manifest_app_version`, e.g. `20.2.1`
|
||||||
* `manifest_app_version`: Numeric app version to call mobile APIs with. (e.g. `221`)
|
* `manifest_app_version`: Numeric app version to call mobile APIs with, e.g. `221`
|
||||||
|
|
||||||
#### rokfinchannel
|
#### rokfinchannel
|
||||||
* `tab`: Which tab to download. One of `new`, `top`, `videos`, `podcasts`, `streams`, `stacks`. (E.g. `rokfinchannel:tab=streams`)
|
* `tab`: Which tab to download - one of `new`, `top`, `videos`, `podcasts`, `streams`, `stacks`
|
||||||
|
|
||||||
|
|
||||||
NOTE: These options may be changed/removed in the future without concern for backward compatibility
|
NOTE: These options may be changed/removed in the future without concern for backward compatibility
|
||||||
@ -2066,7 +2065,7 @@ #### Not recommended
|
|||||||
--all-formats -f all
|
--all-formats -f all
|
||||||
--all-subs --sub-langs all --write-subs
|
--all-subs --sub-langs all --write-subs
|
||||||
--print-json -j --no-simulate
|
--print-json -j --no-simulate
|
||||||
--autonumber-size NUMBER Use string formatting. Eg: %(autonumber)03d
|
--autonumber-size NUMBER Use string formatting, e.g. %(autonumber)03d
|
||||||
--autonumber-start NUMBER Use internal field formatting like %(autonumber+NUMBER)s
|
--autonumber-start NUMBER Use internal field formatting like %(autonumber+NUMBER)s
|
||||||
--id -o "%(id)s.%(ext)s"
|
--id -o "%(id)s.%(ext)s"
|
||||||
--metadata-from-title FORMAT --parse-metadata "%(title)s:FORMAT"
|
--metadata-from-title FORMAT --parse-metadata "%(title)s:FORMAT"
|
||||||
|
@ -1584,7 +1584,7 @@ # Supported sites
|
|||||||
- **youtube:clip**
|
- **youtube:clip**
|
||||||
- **youtube:favorites**: YouTube liked videos; ":ytfav" keyword (requires cookies)
|
- **youtube:favorites**: YouTube liked videos; ":ytfav" keyword (requires cookies)
|
||||||
- **youtube:history**: Youtube watch history; ":ythis" keyword (requires cookies)
|
- **youtube:history**: Youtube watch history; ":ythis" keyword (requires cookies)
|
||||||
- **youtube:music:search_url**: YouTube music search URLs with selectable sections (Eg: #songs)
|
- **youtube:music:search_url**: YouTube music search URLs with selectable sections, e.g. #songs
|
||||||
- **youtube:notif**: YouTube notifications; ":ytnotif" keyword (requires cookies)
|
- **youtube:notif**: YouTube notifications; ":ytnotif" keyword (requires cookies)
|
||||||
- **youtube:playlist**: YouTube playlists
|
- **youtube:playlist**: YouTube playlists
|
||||||
- **youtube:recommended**: YouTube recommended videos; ":ytrec" keyword
|
- **youtube:recommended**: YouTube recommended videos; ":ytrec" keyword
|
||||||
|
@ -272,7 +272,7 @@ class YoutubeDL:
|
|||||||
subtitleslangs: List of languages of the subtitles to download (can be regex).
|
subtitleslangs: List of languages of the subtitles to download (can be regex).
|
||||||
The list may contain "all" to refer to all the available
|
The list may contain "all" to refer to all the available
|
||||||
subtitles. The language can be prefixed with a "-" to
|
subtitles. The language can be prefixed with a "-" to
|
||||||
exclude it from the requested languages. Eg: ['all', '-live_chat']
|
exclude it from the requested languages, e.g. ['all', '-live_chat']
|
||||||
keepvideo: Keep the video file after post-processing
|
keepvideo: Keep the video file after post-processing
|
||||||
daterange: A DateRange object, download only if the upload_date is in the range.
|
daterange: A DateRange object, download only if the upload_date is in the range.
|
||||||
skip_download: Skip the actual download of the video file
|
skip_download: Skip the actual download of the video file
|
||||||
@ -302,7 +302,7 @@ class YoutubeDL:
|
|||||||
cookiefile: File name or text stream from where cookies should be read and dumped to
|
cookiefile: File name or text stream from where cookies should be read and dumped to
|
||||||
cookiesfrombrowser: A tuple containing the name of the browser, the profile
|
cookiesfrombrowser: A tuple containing the name of the browser, the profile
|
||||||
name/pathfrom where cookies are loaded, and the name of the
|
name/pathfrom where cookies are loaded, and the name of the
|
||||||
keyring. Eg: ('chrome', ) or ('vivaldi', 'default', 'BASICTEXT')
|
keyring, e.g. ('chrome', ) or ('vivaldi', 'default', 'BASICTEXT')
|
||||||
legacyserverconnect: Explicitly allow HTTPS connection to servers that do not
|
legacyserverconnect: Explicitly allow HTTPS connection to servers that do not
|
||||||
support RFC 5746 secure renegotiation
|
support RFC 5746 secure renegotiation
|
||||||
nocheckcertificate: Do not verify SSL certificates
|
nocheckcertificate: Do not verify SSL certificates
|
||||||
@ -470,7 +470,7 @@ class YoutubeDL:
|
|||||||
discontinuities such as ad breaks (default: False)
|
discontinuities such as ad breaks (default: False)
|
||||||
extractor_args: A dictionary of arguments to be passed to the extractors.
|
extractor_args: A dictionary of arguments to be passed to the extractors.
|
||||||
See "EXTRACTOR ARGUMENTS" for details.
|
See "EXTRACTOR ARGUMENTS" for details.
|
||||||
Eg: {'youtube': {'skip': ['dash', 'hls']}}
|
E.g. {'youtube': {'skip': ['dash', 'hls']}}
|
||||||
mark_watched: Mark videos watched (even with --simulate). Only for YouTube
|
mark_watched: Mark videos watched (even with --simulate). Only for YouTube
|
||||||
|
|
||||||
The following options are deprecated and may be removed in the future:
|
The following options are deprecated and may be removed in the future:
|
||||||
@ -1046,7 +1046,7 @@ def _outtmpl_expandpath(outtmpl):
|
|||||||
|
|
||||||
# outtmpl should be expand_path'ed before template dict substitution
|
# outtmpl should be expand_path'ed before template dict substitution
|
||||||
# because meta fields may contain env variables we don't want to
|
# because meta fields may contain env variables we don't want to
|
||||||
# be expanded. For example, for outtmpl "%(title)s.%(ext)s" and
|
# be expanded. E.g. for outtmpl "%(title)s.%(ext)s" and
|
||||||
# title "Hello $PATH", we don't want `$PATH` to be expanded.
|
# title "Hello $PATH", we don't want `$PATH` to be expanded.
|
||||||
return expand_path(outtmpl).replace(sep, '')
|
return expand_path(outtmpl).replace(sep, '')
|
||||||
|
|
||||||
@ -1977,8 +1977,8 @@ def _parse_filter(tokens):
|
|||||||
filter_parts.append(string)
|
filter_parts.append(string)
|
||||||
|
|
||||||
def _remove_unused_ops(tokens):
|
def _remove_unused_ops(tokens):
|
||||||
# Remove operators that we don't use and join them with the surrounding strings
|
# Remove operators that we don't use and join them with the surrounding strings.
|
||||||
# for example: 'mp4' '-' 'baseline' '-' '16x9' is converted to 'mp4-baseline-16x9'
|
# E.g. 'mp4' '-' 'baseline' '-' '16x9' is converted to 'mp4-baseline-16x9'
|
||||||
ALLOWED_OPS = ('/', '+', ',', '(', ')')
|
ALLOWED_OPS = ('/', '+', ',', '(', ')')
|
||||||
last_string, last_start, last_end, last_line = None, None, None, None
|
last_string, last_start, last_end, last_line = None, None, None, None
|
||||||
for type, string, start, end, line in tokens:
|
for type, string, start, end, line in tokens:
|
||||||
|
@ -184,7 +184,7 @@ def build_fragments_list(boot_info):
|
|||||||
first_frag_number = fragment_run_entry_table[0]['first']
|
first_frag_number = fragment_run_entry_table[0]['first']
|
||||||
fragments_counter = itertools.count(first_frag_number)
|
fragments_counter = itertools.count(first_frag_number)
|
||||||
for segment, fragments_count in segment_run_table['segment_run']:
|
for segment, fragments_count in segment_run_table['segment_run']:
|
||||||
# In some live HDS streams (for example Rai), `fragments_count` is
|
# In some live HDS streams (e.g. Rai), `fragments_count` is
|
||||||
# abnormal and causing out-of-memory errors. It's OK to change the
|
# abnormal and causing out-of-memory errors. It's OK to change the
|
||||||
# number of fragments for live streams as they are updated periodically
|
# number of fragments for live streams as they are updated periodically
|
||||||
if fragments_count == 4294967295 and boot_info['live']:
|
if fragments_count == 4294967295 and boot_info['live']:
|
||||||
|
@ -365,7 +365,7 @@ def _real_extract(self, url):
|
|||||||
# read breadcrumb on top of page
|
# read breadcrumb on top of page
|
||||||
breadcrumb = self._extract_breadcrumb_list(webpage, video_id)
|
breadcrumb = self._extract_breadcrumb_list(webpage, video_id)
|
||||||
if breadcrumb:
|
if breadcrumb:
|
||||||
# breadcrumb list translates to: (example is 1st test for this IE)
|
# breadcrumb list translates to: (e.g. 1st test for this IE)
|
||||||
# Home > Anime (genre) > Isekai Shokudo 2 (series name) > Episode 1 "Cheese cakes" "Morning again" (episode title)
|
# Home > Anime (genre) > Isekai Shokudo 2 (series name) > Episode 1 "Cheese cakes" "Morning again" (episode title)
|
||||||
# hence this works
|
# hence this works
|
||||||
info['series'] = breadcrumb[-2]
|
info['series'] = breadcrumb[-2]
|
||||||
|
@ -331,7 +331,7 @@ class InfoExtractor:
|
|||||||
playable_in_embed: Whether this video is allowed to play in embedded
|
playable_in_embed: Whether this video is allowed to play in embedded
|
||||||
players on other sites. Can be True (=always allowed),
|
players on other sites. Can be True (=always allowed),
|
||||||
False (=never allowed), None (=unknown), or a string
|
False (=never allowed), None (=unknown), or a string
|
||||||
specifying the criteria for embedability (Eg: 'whitelist')
|
specifying the criteria for embedability; e.g. 'whitelist'
|
||||||
availability: Under what condition the video is available. One of
|
availability: Under what condition the video is available. One of
|
||||||
'private', 'premium_only', 'subscriber_only', 'needs_auth',
|
'private', 'premium_only', 'subscriber_only', 'needs_auth',
|
||||||
'unlisted' or 'public'. Use 'InfoExtractor._availability'
|
'unlisted' or 'public'. Use 'InfoExtractor._availability'
|
||||||
@ -452,8 +452,8 @@ class InfoExtractor:
|
|||||||
|
|
||||||
_extract_from_webpage may raise self.StopExtraction() to stop further
|
_extract_from_webpage may raise self.StopExtraction() to stop further
|
||||||
processing of the webpage and obtain exclusive rights to it. This is useful
|
processing of the webpage and obtain exclusive rights to it. This is useful
|
||||||
when the extractor cannot reliably be matched using just the URL.
|
when the extractor cannot reliably be matched using just the URL,
|
||||||
Eg: invidious/peertube instances
|
e.g. invidious/peertube instances
|
||||||
|
|
||||||
Embed-only extractors can be defined by setting _VALID_URL = False.
|
Embed-only extractors can be defined by setting _VALID_URL = False.
|
||||||
|
|
||||||
@ -2367,7 +2367,7 @@ def build_stream_name():
|
|||||||
audio_group_id = last_stream_inf.get('AUDIO')
|
audio_group_id = last_stream_inf.get('AUDIO')
|
||||||
# As per [1, 4.3.4.1.1] any EXT-X-STREAM-INF tag which
|
# As per [1, 4.3.4.1.1] any EXT-X-STREAM-INF tag which
|
||||||
# references a rendition group MUST have a CODECS attribute.
|
# references a rendition group MUST have a CODECS attribute.
|
||||||
# However, this is not always respected, for example, [2]
|
# However, this is not always respected. E.g. [2]
|
||||||
# contains EXT-X-STREAM-INF tag which references AUDIO
|
# contains EXT-X-STREAM-INF tag which references AUDIO
|
||||||
# rendition group but does not have CODECS and despite
|
# rendition group but does not have CODECS and despite
|
||||||
# referencing an audio group it represents a complete
|
# referencing an audio group it represents a complete
|
||||||
@ -3003,8 +3003,8 @@ def add_segment_url():
|
|||||||
segment_number += 1
|
segment_number += 1
|
||||||
segment_time += segment_d
|
segment_time += segment_d
|
||||||
elif 'segment_urls' in representation_ms_info and 's' in representation_ms_info:
|
elif 'segment_urls' in representation_ms_info and 's' in representation_ms_info:
|
||||||
# No media template
|
# No media template,
|
||||||
# Example: https://www.youtube.com/watch?v=iXZV5uAYMJI
|
# e.g. https://www.youtube.com/watch?v=iXZV5uAYMJI
|
||||||
# or any YouTube dashsegments video
|
# or any YouTube dashsegments video
|
||||||
fragments = []
|
fragments = []
|
||||||
segment_index = 0
|
segment_index = 0
|
||||||
@ -3021,7 +3021,7 @@ def add_segment_url():
|
|||||||
representation_ms_info['fragments'] = fragments
|
representation_ms_info['fragments'] = fragments
|
||||||
elif 'segment_urls' in representation_ms_info:
|
elif 'segment_urls' in representation_ms_info:
|
||||||
# Segment URLs with no SegmentTimeline
|
# Segment URLs with no SegmentTimeline
|
||||||
# Example: https://www.seznam.cz/zpravy/clanek/cesko-zasahne-vitr-o-sile-vichrice-muze-byt-i-zivotu-nebezpecny-39091
|
# E.g. https://www.seznam.cz/zpravy/clanek/cesko-zasahne-vitr-o-sile-vichrice-muze-byt-i-zivotu-nebezpecny-39091
|
||||||
# https://github.com/ytdl-org/youtube-dl/pull/14844
|
# https://github.com/ytdl-org/youtube-dl/pull/14844
|
||||||
fragments = []
|
fragments = []
|
||||||
segment_duration = float_or_none(
|
segment_duration = float_or_none(
|
||||||
@ -3249,8 +3249,8 @@ def _media_formats(src, cur_media_type, type_info=None):
|
|||||||
media_tags.extend(re.findall(
|
media_tags.extend(re.findall(
|
||||||
# We only allow video|audio followed by a whitespace or '>'.
|
# We only allow video|audio followed by a whitespace or '>'.
|
||||||
# Allowing more characters may end up in significant slow down (see
|
# Allowing more characters may end up in significant slow down (see
|
||||||
# https://github.com/ytdl-org/youtube-dl/issues/11979, example URL:
|
# https://github.com/ytdl-org/youtube-dl/issues/11979,
|
||||||
# http://www.porntrex.com/maps/videositemap.xml).
|
# e.g. http://www.porntrex.com/maps/videositemap.xml).
|
||||||
r'(?s)(<(?P<tag>%s)(?:\s+[^>]*)?>)(.*?)</(?P=tag)>' % _MEDIA_TAG_NAME_RE, webpage))
|
r'(?s)(<(?P<tag>%s)(?:\s+[^>]*)?>)(.*?)</(?P=tag)>' % _MEDIA_TAG_NAME_RE, webpage))
|
||||||
for media_tag, _, media_type, media_content in media_tags:
|
for media_tag, _, media_type, media_content in media_tags:
|
||||||
media_info = {
|
media_info = {
|
||||||
@ -3706,7 +3706,7 @@ def description(cls, *, markdown=True, search_examples=None):
|
|||||||
desc += f'; "{cls.SEARCH_KEY}:" prefix'
|
desc += f'; "{cls.SEARCH_KEY}:" prefix'
|
||||||
if search_examples:
|
if search_examples:
|
||||||
_COUNTS = ('', '5', '10', 'all')
|
_COUNTS = ('', '5', '10', 'all')
|
||||||
desc += f' (Example: "{cls.SEARCH_KEY}{random.choice(_COUNTS)}:{random.choice(search_examples)}")'
|
desc += f' (e.g. "{cls.SEARCH_KEY}{random.choice(_COUNTS)}:{random.choice(search_examples)}")'
|
||||||
if not cls.working():
|
if not cls.working():
|
||||||
desc += ' (**Currently broken**)' if markdown else ' (Currently broken)'
|
desc += ' (**Currently broken**)' if markdown else ' (Currently broken)'
|
||||||
|
|
||||||
|
@ -3035,7 +3035,7 @@ def filter_video(urls):
|
|||||||
self.report_detected('Twitter card')
|
self.report_detected('Twitter card')
|
||||||
if not found:
|
if not found:
|
||||||
# We look for Open Graph info:
|
# We look for Open Graph info:
|
||||||
# We have to match any number spaces between elements, some sites try to align them (eg.: statigr.am)
|
# We have to match any number spaces between elements, some sites try to align them, e.g.: statigr.am
|
||||||
m_video_type = re.findall(r'<meta.*?property="og:video:type".*?content="video/(.*?)"', webpage)
|
m_video_type = re.findall(r'<meta.*?property="og:video:type".*?content="video/(.*?)"', webpage)
|
||||||
# We only look in og:video if the MIME type is a video, don't try if it's a Flash player:
|
# We only look in og:video if the MIME type is a video, don't try if it's a Flash player:
|
||||||
if m_video_type is not None:
|
if m_video_type is not None:
|
||||||
|
@ -169,7 +169,7 @@ def get(self, url, html=None, video_id=None, note=None, note2='Executing JS on w
|
|||||||
In most cases you don't need to add any `jscode`.
|
In most cases you don't need to add any `jscode`.
|
||||||
It is executed in `page.onLoadFinished`.
|
It is executed in `page.onLoadFinished`.
|
||||||
`saveAndExit();` is mandatory, use it instead of `phantom.exit()`
|
`saveAndExit();` is mandatory, use it instead of `phantom.exit()`
|
||||||
It is possible to wait for some element on the webpage, for example:
|
It is possible to wait for some element on the webpage, e.g.
|
||||||
var check = function() {
|
var check = function() {
|
||||||
var elementFound = page.evaluate(function() {
|
var elementFound = page.evaluate(function() {
|
||||||
return document.querySelector('#b.done') !== null;
|
return document.querySelector('#b.done') !== null;
|
||||||
|
@ -3247,9 +3247,9 @@ def _extract_formats_and_subtitles(self, streaming_data, video_id, player_url, i
|
|||||||
else -10 if 'descriptive' in (audio_track.get('displayName') or '').lower() and -10
|
else -10 if 'descriptive' in (audio_track.get('displayName') or '').lower() and -10
|
||||||
else -1)
|
else -1)
|
||||||
# Some formats may have much smaller duration than others (possibly damaged during encoding)
|
# Some formats may have much smaller duration than others (possibly damaged during encoding)
|
||||||
# Eg: 2-nOtRESiUc Ref: https://github.com/yt-dlp/yt-dlp/issues/2823
|
# E.g. 2-nOtRESiUc Ref: https://github.com/yt-dlp/yt-dlp/issues/2823
|
||||||
# Make sure to avoid false positives with small duration differences.
|
# Make sure to avoid false positives with small duration differences.
|
||||||
# Eg: __2ABJjxzNo, ySuUZEjARPY
|
# E.g. __2ABJjxzNo, ySuUZEjARPY
|
||||||
is_damaged = try_get(fmt, lambda x: float(x['approxDurationMs']) / duration < 500)
|
is_damaged = try_get(fmt, lambda x: float(x['approxDurationMs']) / duration < 500)
|
||||||
if is_damaged:
|
if is_damaged:
|
||||||
self.report_warning(
|
self.report_warning(
|
||||||
@ -5834,7 +5834,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
|
|
||||||
class YoutubeMusicSearchURLIE(YoutubeTabBaseInfoExtractor):
|
class YoutubeMusicSearchURLIE(YoutubeTabBaseInfoExtractor):
|
||||||
IE_DESC = 'YouTube music search URLs with selectable sections (Eg: #songs)'
|
IE_DESC = 'YouTube music search URLs with selectable sections, e.g. #songs'
|
||||||
IE_NAME = 'youtube:music:search_url'
|
IE_NAME = 'youtube:music:search_url'
|
||||||
_VALID_URL = r'https?://music\.youtube\.com/search\?([^#]+&)?(?:search_query|q)=(?:[^&]+)(?:[&#]|$)'
|
_VALID_URL = r'https?://music\.youtube\.com/search\?([^#]+&)?(?:search_query|q)=(?:[^&]+)(?:[&#]|$)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
|
@ -34,7 +34,7 @@ def format_text(text, f):
|
|||||||
'''
|
'''
|
||||||
@param f String representation of formatting to apply in the form:
|
@param f String representation of formatting to apply in the form:
|
||||||
[style] [light] font_color [on [light] bg_color]
|
[style] [light] font_color [on [light] bg_color]
|
||||||
Eg: "red", "bold green on light blue"
|
E.g. "red", "bold green on light blue"
|
||||||
'''
|
'''
|
||||||
f = f.upper()
|
f = f.upper()
|
||||||
tokens = f.strip().split()
|
tokens = f.strip().split()
|
||||||
|
@ -77,7 +77,7 @@ def add_config(label, path, user=False):
|
|||||||
if root.parse_known_args()[0].ignoreconfig:
|
if root.parse_known_args()[0].ignoreconfig:
|
||||||
return False
|
return False
|
||||||
# Multiple package names can be given here
|
# Multiple package names can be given here
|
||||||
# Eg: ('yt-dlp', 'youtube-dlc', 'youtube-dl') will look for
|
# E.g. ('yt-dlp', 'youtube-dlc', 'youtube-dl') will look for
|
||||||
# the configuration file of any of these three packages
|
# the configuration file of any of these three packages
|
||||||
for package in ('yt-dlp',):
|
for package in ('yt-dlp',):
|
||||||
if user:
|
if user:
|
||||||
@ -374,7 +374,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
dest='default_search', metavar='PREFIX',
|
dest='default_search', metavar='PREFIX',
|
||||||
help=(
|
help=(
|
||||||
'Use this prefix for unqualified URLs. '
|
'Use this prefix for unqualified URLs. '
|
||||||
'Eg: "gvsearch2:python" downloads two videos from google videos for the search term "python". '
|
'E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". '
|
||||||
'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). '
|
'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). '
|
||||||
'"error" just throws an error. The default value "fixup_error" repairs broken URLs, '
|
'"error" just throws an error. The default value "fixup_error" repairs broken URLs, '
|
||||||
'but emits an error if this is not possible instead of searching'))
|
'but emits an error if this is not possible instead of searching'))
|
||||||
@ -459,7 +459,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
help=(
|
help=(
|
||||||
'Create aliases for an option string. Unless an alias starts with a dash "-", it is prefixed with "--". '
|
'Create aliases for an option string. Unless an alias starts with a dash "-", it is prefixed with "--". '
|
||||||
'Arguments are parsed according to the Python string formatting mini-language. '
|
'Arguments are parsed according to the Python string formatting mini-language. '
|
||||||
'Eg: --alias get-audio,-X "-S=aext:{0},abr -x --audio-format {0}" creates options '
|
'E.g. --alias get-audio,-X "-S=aext:{0},abr -x --audio-format {0}" creates options '
|
||||||
'"--get-audio" and "-X" that takes an argument (ARG0) and expands to '
|
'"--get-audio" and "-X" that takes an argument (ARG0) and expands to '
|
||||||
'"-S=aext:ARG0,abr -x --audio-format ARG0". All defined aliases are listed in the --help output. '
|
'"-S=aext:ARG0,abr -x --audio-format ARG0". All defined aliases are listed in the --help output. '
|
||||||
'Alias options can trigger more aliases; so be careful to avoid defining recursive options. '
|
'Alias options can trigger more aliases; so be careful to avoid defining recursive options. '
|
||||||
@ -471,8 +471,8 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'--proxy', dest='proxy',
|
'--proxy', dest='proxy',
|
||||||
default=None, metavar='URL',
|
default=None, metavar='URL',
|
||||||
help=(
|
help=(
|
||||||
'Use the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme. '
|
'Use the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme, '
|
||||||
'Eg: socks5://user:pass@127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection'))
|
'e.g. socks5://user:pass@127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection'))
|
||||||
network.add_option(
|
network.add_option(
|
||||||
'--socket-timeout',
|
'--socket-timeout',
|
||||||
dest='socket_timeout', type=float, default=None, metavar='SECONDS',
|
dest='socket_timeout', type=float, default=None, metavar='SECONDS',
|
||||||
@ -537,7 +537,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'Comma separated playlist_index of the videos to download. '
|
'Comma separated playlist_index of the videos to download. '
|
||||||
'You can specify a range using "[START]:[STOP][:STEP]". For backward compatibility, START-STOP is also supported. '
|
'You can specify a range using "[START]:[STOP][:STEP]". For backward compatibility, START-STOP is also supported. '
|
||||||
'Use negative indices to count from the right and negative STEP to download in reverse order. '
|
'Use negative indices to count from the right and negative STEP to download in reverse order. '
|
||||||
'Eg: "-I 1:3,7,-5::2" used on a playlist of size 15 will download the videos at index 1,2,3,7,11,13,15'))
|
'E.g. "-I 1:3,7,-5::2" used on a playlist of size 15 will download the videos at index 1,2,3,7,11,13,15'))
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--match-title',
|
'--match-title',
|
||||||
dest='matchtitle', metavar='REGEX',
|
dest='matchtitle', metavar='REGEX',
|
||||||
@ -549,17 +549,17 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--min-filesize',
|
'--min-filesize',
|
||||||
metavar='SIZE', dest='min_filesize', default=None,
|
metavar='SIZE', dest='min_filesize', default=None,
|
||||||
help='Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)')
|
help='Do not download any videos smaller than SIZE, e.g. 50k or 44.6M')
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--max-filesize',
|
'--max-filesize',
|
||||||
metavar='SIZE', dest='max_filesize', default=None,
|
metavar='SIZE', dest='max_filesize', default=None,
|
||||||
help='Do not download any videos larger than SIZE (e.g. 50k or 44.6m)')
|
help='Do not download any videos larger than SIZE, e.g. 50k or 44.6M')
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--date',
|
'--date',
|
||||||
metavar='DATE', dest='date', default=None,
|
metavar='DATE', dest='date', default=None,
|
||||||
help=(
|
help=(
|
||||||
'Download only videos uploaded on this date. The date can be "YYYYMMDD" or in the format '
|
'Download only videos uploaded on this date. The date can be "YYYYMMDD" or in the format '
|
||||||
'[now|today|yesterday][-N[day|week|month|year]]. Eg: --date today-2weeks'))
|
'[now|today|yesterday][-N[day|week|month|year]]. E.g. --date today-2weeks'))
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--datebefore',
|
'--datebefore',
|
||||||
metavar='DATE', dest='datebefore', default=None,
|
metavar='DATE', dest='datebefore', default=None,
|
||||||
@ -589,7 +589,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'You can also simply specify a field to match if the field is present, '
|
'You can also simply specify a field to match if the field is present, '
|
||||||
'use "!field" to check if the field is not present, and "&" to check multiple conditions. '
|
'use "!field" to check if the field is not present, and "&" to check multiple conditions. '
|
||||||
'Use a "\\" to escape "&" or quotes if needed. If used multiple times, '
|
'Use a "\\" to escape "&" or quotes if needed. If used multiple times, '
|
||||||
'the filter matches if atleast one of the conditions are met. Eg: --match-filter '
|
'the filter matches if atleast one of the conditions are met. E.g. --match-filter '
|
||||||
'!is_live --match-filter "like_count>?100 & description~=\'(?i)\\bcats \\& dogs\\b\'" '
|
'!is_live --match-filter "like_count>?100 & description~=\'(?i)\\bcats \\& dogs\\b\'" '
|
||||||
'matches only videos that are not live OR those that have a like count more than 100 '
|
'matches only videos that are not live OR those that have a like count more than 100 '
|
||||||
'(or the like field is not available) and also has a description '
|
'(or the like field is not available) and also has a description '
|
||||||
@ -785,7 +785,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'--merge-output-format',
|
'--merge-output-format',
|
||||||
action='store', dest='merge_output_format', metavar='FORMAT', default=None,
|
action='store', dest='merge_output_format', metavar='FORMAT', default=None,
|
||||||
help=(
|
help=(
|
||||||
'Containers that may be used when merging formats, separated by "/" (Eg: "mp4/mkv"). '
|
'Containers that may be used when merging formats, separated by "/", e.g. "mp4/mkv". '
|
||||||
'Ignored if no merge is required. '
|
'Ignored if no merge is required. '
|
||||||
f'(currently supported: {", ".join(sorted(FFmpegMergerPP.SUPPORTED_EXTS))})'))
|
f'(currently supported: {", ".join(sorted(FFmpegMergerPP.SUPPORTED_EXTS))})'))
|
||||||
video_format.add_option(
|
video_format.add_option(
|
||||||
@ -825,14 +825,14 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
subtitles.add_option(
|
subtitles.add_option(
|
||||||
'--sub-format',
|
'--sub-format',
|
||||||
action='store', dest='subtitlesformat', metavar='FORMAT', default='best',
|
action='store', dest='subtitlesformat', metavar='FORMAT', default='best',
|
||||||
help='Subtitle format; accepts formats preference, Eg: "srt" or "ass/srt/best"')
|
help='Subtitle format; accepts formats preference, e.g. "srt" or "ass/srt/best"')
|
||||||
subtitles.add_option(
|
subtitles.add_option(
|
||||||
'--sub-langs', '--srt-langs',
|
'--sub-langs', '--srt-langs',
|
||||||
action='callback', dest='subtitleslangs', metavar='LANGS', type='str',
|
action='callback', dest='subtitleslangs', metavar='LANGS', type='str',
|
||||||
default=[], callback=_list_from_options_callback,
|
default=[], callback=_list_from_options_callback,
|
||||||
help=(
|
help=(
|
||||||
'Languages of the subtitles to download (can be regex) or "all" separated by commas. (Eg: --sub-langs "en.*,ja") '
|
'Languages of the subtitles to download (can be regex) or "all" separated by commas, e.g. --sub-langs "en.*,ja". '
|
||||||
'You can prefix the language code with a "-" to exclude it from the requested languages. (Eg: --sub-langs all,-live_chat) '
|
'You can prefix the language code with a "-" to exclude it from the requested languages, e.g. --sub-langs all,-live_chat. '
|
||||||
'Use --list-subs for a list of available language tags'))
|
'Use --list-subs for a list of available language tags'))
|
||||||
|
|
||||||
downloader = optparse.OptionGroup(parser, 'Download Options')
|
downloader = optparse.OptionGroup(parser, 'Download Options')
|
||||||
@ -843,11 +843,11 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'-r', '--limit-rate', '--rate-limit',
|
'-r', '--limit-rate', '--rate-limit',
|
||||||
dest='ratelimit', metavar='RATE',
|
dest='ratelimit', metavar='RATE',
|
||||||
help='Maximum download rate in bytes per second (e.g. 50K or 4.2M)')
|
help='Maximum download rate in bytes per second, e.g. 50K or 4.2M')
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--throttled-rate',
|
'--throttled-rate',
|
||||||
dest='throttledratelimit', metavar='RATE',
|
dest='throttledratelimit', metavar='RATE',
|
||||||
help='Minimum download rate in bytes per second below which throttling is assumed and the video data is re-extracted (e.g. 100K)')
|
help='Minimum download rate in bytes per second below which throttling is assumed and the video data is re-extracted, e.g. 100K')
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'-R', '--retries',
|
'-R', '--retries',
|
||||||
dest='retries', metavar='RETRIES', default=10,
|
dest='retries', metavar='RETRIES', default=10,
|
||||||
@ -871,8 +871,8 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'Time to sleep between retries in seconds (optionally) prefixed by the type of retry '
|
'Time to sleep between retries in seconds (optionally) prefixed by the type of retry '
|
||||||
'(http (default), fragment, file_access, extractor) to apply the sleep to. '
|
'(http (default), fragment, file_access, extractor) to apply the sleep to. '
|
||||||
'EXPR can be a number, linear=START[:END[:STEP=1]] or exp=START[:END[:BASE=2]]. '
|
'EXPR can be a number, linear=START[:END[:STEP=1]] or exp=START[:END[:BASE=2]]. '
|
||||||
'This option can be used multiple times to set the sleep for the different retry types. '
|
'This option can be used multiple times to set the sleep for the different retry types, '
|
||||||
'Eg: --retry-sleep linear=1::2 --retry-sleep fragment:exp=1:20'))
|
'e.g. --retry-sleep linear=1::2 --retry-sleep fragment:exp=1:20'))
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--skip-unavailable-fragments', '--no-abort-on-unavailable-fragment',
|
'--skip-unavailable-fragments', '--no-abort-on-unavailable-fragment',
|
||||||
action='store_true', dest='skip_unavailable_fragments', default=True,
|
action='store_true', dest='skip_unavailable_fragments', default=True,
|
||||||
@ -892,7 +892,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--buffer-size',
|
'--buffer-size',
|
||||||
dest='buffersize', metavar='SIZE', default='1024',
|
dest='buffersize', metavar='SIZE', default='1024',
|
||||||
help='Size of download buffer (e.g. 1024 or 16K) (default is %default)')
|
help='Size of download buffer, e.g. 1024 or 16K (default is %default)')
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--resize-buffer',
|
'--resize-buffer',
|
||||||
action='store_false', dest='noresizebuffer',
|
action='store_false', dest='noresizebuffer',
|
||||||
@ -905,7 +905,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'--http-chunk-size',
|
'--http-chunk-size',
|
||||||
dest='http_chunk_size', metavar='SIZE', default=None,
|
dest='http_chunk_size', metavar='SIZE', default=None,
|
||||||
help=(
|
help=(
|
||||||
'Size of a chunk for chunk-based HTTP downloading (e.g. 10485760 or 10M) (default is disabled). '
|
'Size of a chunk for chunk-based HTTP downloading, e.g. 10485760 or 10M (default is disabled). '
|
||||||
'May be useful for bypassing bandwidth throttling imposed by a webserver (experimental)'))
|
'May be useful for bypassing bandwidth throttling imposed by a webserver (experimental)'))
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--test',
|
'--test',
|
||||||
@ -963,8 +963,8 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
help=(
|
help=(
|
||||||
'Download only chapters whose title matches the given regular expression. '
|
'Download only chapters whose title matches the given regular expression. '
|
||||||
'Time ranges prefixed by a "*" can also be used in place of chapters to download the specified range. '
|
'Time ranges prefixed by a "*" can also be used in place of chapters to download the specified range. '
|
||||||
'Eg: --download-sections "*10:15-15:00" --download-sections "intro". '
|
'Needs ffmpeg. This option can be used multiple times to download multiple sections, '
|
||||||
'Needs ffmpeg. This option can be used multiple times to download multiple sections'))
|
'e.g. --download-sections "*10:15-15:00" --download-sections "intro"'))
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--downloader', '--external-downloader',
|
'--downloader', '--external-downloader',
|
||||||
dest='external_downloader', metavar='[PROTO:]NAME', default={}, type='str',
|
dest='external_downloader', metavar='[PROTO:]NAME', default={}, type='str',
|
||||||
@ -978,7 +978,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'the protocols (http, ftp, m3u8, dash, rstp, rtmp, mms) to use it for. '
|
'the protocols (http, ftp, m3u8, dash, rstp, rtmp, mms) to use it for. '
|
||||||
f'Currently supports native, {", ".join(sorted(list_external_downloaders()))}. '
|
f'Currently supports native, {", ".join(sorted(list_external_downloaders()))}. '
|
||||||
'You can use this option multiple times to set different downloaders for different protocols. '
|
'You can use this option multiple times to set different downloaders for different protocols. '
|
||||||
'For example, --downloader aria2c --downloader "dash,m3u8:native" will use '
|
'E.g. --downloader aria2c --downloader "dash,m3u8:native" will use '
|
||||||
'aria2c for http/ftp downloads, and the native downloader for dash/m3u8 downloads '
|
'aria2c for http/ftp downloads, and the native downloader for dash/m3u8 downloads '
|
||||||
'(Alias: --external-downloader)'))
|
'(Alias: --external-downloader)'))
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
@ -1188,7 +1188,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'Template for progress outputs, optionally prefixed with one of "download:" (default), '
|
'Template for progress outputs, optionally prefixed with one of "download:" (default), '
|
||||||
'"download-title:" (the console title), "postprocess:", or "postprocess-title:". '
|
'"download-title:" (the console title), "postprocess:", or "postprocess-title:". '
|
||||||
'The video\'s fields are accessible under the "info" key and '
|
'The video\'s fields are accessible under the "info" key and '
|
||||||
'the progress attributes are accessible under "progress" key. E.g.: '
|
'the progress attributes are accessible under "progress" key. E.g. '
|
||||||
# TODO: Document the fields inside "progress"
|
# TODO: Document the fields inside "progress"
|
||||||
'--console-title --progress-template "download-title:%(info.id)s-%(progress.eta)s"'))
|
'--console-title --progress-template "download-title:%(info.id)s-%(progress.eta)s"'))
|
||||||
verbosity.add_option(
|
verbosity.add_option(
|
||||||
@ -1488,7 +1488,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'Remux the video into another container if necessary '
|
'Remux the video into another container if necessary '
|
||||||
f'(currently supported: {", ".join(FFmpegVideoRemuxerPP.SUPPORTED_EXTS)}). '
|
f'(currently supported: {", ".join(FFmpegVideoRemuxerPP.SUPPORTED_EXTS)}). '
|
||||||
'If target container does not support the video/audio codec, remuxing will fail. You can specify multiple rules; '
|
'If target container does not support the video/audio codec, remuxing will fail. You can specify multiple rules; '
|
||||||
'Eg. "aac>m4a/mov>mp4/mkv" will remux aac to m4a, mov to mp4 and anything else to mkv'))
|
'e.g. "aac>m4a/mov>mp4/mkv" will remux aac to m4a, mov to mp4 and anything else to mkv'))
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'--recode-video',
|
'--recode-video',
|
||||||
metavar='FORMAT', dest='recodevideo', default=None,
|
metavar='FORMAT', dest='recodevideo', default=None,
|
||||||
@ -1513,7 +1513,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'You can also specify "PP+EXE:ARGS" to give the arguments to the specified executable '
|
'You can also specify "PP+EXE:ARGS" to give the arguments to the specified executable '
|
||||||
'only when being used by the specified postprocessor. Additionally, for ffmpeg/ffprobe, '
|
'only when being used by the specified postprocessor. Additionally, for ffmpeg/ffprobe, '
|
||||||
'"_i"/"_o" can be appended to the prefix optionally followed by a number to pass the argument '
|
'"_i"/"_o" can be appended to the prefix optionally followed by a number to pass the argument '
|
||||||
'before the specified input/output file. Eg: --ppa "Merger+ffmpeg_i1:-v quiet". '
|
'before the specified input/output file, e.g. --ppa "Merger+ffmpeg_i1:-v quiet". '
|
||||||
'You can use this option multiple times to give different arguments to different '
|
'You can use this option multiple times to give different arguments to different '
|
||||||
'postprocessors. (Alias: --ppa)'))
|
'postprocessors. (Alias: --ppa)'))
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
@ -1729,7 +1729,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
|
|||||||
'SponsorBlock categories to create chapters for, separated by commas. '
|
'SponsorBlock categories to create chapters for, separated by commas. '
|
||||||
f'Available categories are {", ".join(SponsorBlockPP.CATEGORIES.keys())}, all and default (=all). '
|
f'Available categories are {", ".join(SponsorBlockPP.CATEGORIES.keys())}, all and default (=all). '
|
||||||
'You can prefix the category with a "-" to exclude it. See [1] for description of the categories. '
|
'You can prefix the category with a "-" to exclude it. See [1] for description of the categories. '
|
||||||
'Eg: --sponsorblock-mark all,-preview [1] https://wiki.sponsor.ajay.app/w/Segment_Categories'))
|
'E.g. --sponsorblock-mark all,-preview [1] https://wiki.sponsor.ajay.app/w/Segment_Categories'))
|
||||||
sponsorblock.add_option(
|
sponsorblock.add_option(
|
||||||
'--sponsorblock-remove', metavar='CATS',
|
'--sponsorblock-remove', metavar='CATS',
|
||||||
dest='sponsorblock_remove', default=set(), action='callback', type='str',
|
dest='sponsorblock_remove', default=set(), action='callback', type='str',
|
||||||
|
@ -610,7 +610,7 @@ def sanitize_open(filename, open_mode):
|
|||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
import msvcrt
|
import msvcrt
|
||||||
|
|
||||||
# stdout may be any IO stream. Eg, when using contextlib.redirect_stdout
|
# stdout may be any IO stream, e.g. when using contextlib.redirect_stdout
|
||||||
with contextlib.suppress(io.UnsupportedOperation):
|
with contextlib.suppress(io.UnsupportedOperation):
|
||||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||||
return (sys.stdout.buffer if hasattr(sys.stdout, 'buffer') else sys.stdout, filename)
|
return (sys.stdout.buffer if hasattr(sys.stdout, 'buffer') else sys.stdout, filename)
|
||||||
@ -786,8 +786,8 @@ def _htmlentity_transform(entity_with_semicolon):
|
|||||||
if entity in html.entities.name2codepoint:
|
if entity in html.entities.name2codepoint:
|
||||||
return chr(html.entities.name2codepoint[entity])
|
return chr(html.entities.name2codepoint[entity])
|
||||||
|
|
||||||
# TODO: HTML5 allows entities without a semicolon. For example,
|
# TODO: HTML5 allows entities without a semicolon.
|
||||||
# 'Éric' should be decoded as 'Éric'.
|
# E.g. 'Éric' should be decoded as 'Éric'.
|
||||||
if entity_with_semicolon in html.entities.html5:
|
if entity_with_semicolon in html.entities.html5:
|
||||||
return html.entities.html5[entity_with_semicolon]
|
return html.entities.html5[entity_with_semicolon]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user