1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-20 01:42:50 +01:00

[cleanup] Minor cleanup

This commit is contained in:
pukkandan 2021-11-04 03:40:35 +05:30
parent 8913ef74d7
commit a4211baff5
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
9 changed files with 24 additions and 22 deletions

View File

@ -43,7 +43,7 @@ body:
attributes: attributes:
label: Verbose log label: Verbose log
description: | description: |
Provide the complete verbose output of yt-dlp that clearly demonstrates the problem. Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below. Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
It should look similar to this: It should look similar to this:
placeholder: | placeholder: |

View File

@ -54,7 +54,7 @@ body:
attributes: attributes:
label: Verbose log label: Verbose log
description: | description: |
Provide the complete verbose output using one of the example URLs provided above. Provide the complete verbose output **using one of the example URLs provided above**.
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below. Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
It should look similar to this: It should look similar to this:
placeholder: | placeholder: |

View File

@ -37,8 +37,8 @@ body:
attributes: attributes:
label: Verbose log label: Verbose log
description: | description: |
Provide the complete verbose output of yt-dlp that clearly demonstrates the problem. Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below. Add the `-Uv` flag to **your** command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
It should look similar to this: It should look similar to this:
placeholder: | placeholder: |
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc'] [debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']

View File

@ -79,7 +79,7 @@ # NEW FEATURES
* Search (`ytsearch:`, `ytsearchdate:`), search URLs and in-channel search works * Search (`ytsearch:`, `ytsearchdate:`), search URLs and in-channel search works
* Mixes supports downloading multiple pages of content * Mixes supports downloading multiple pages of content
* Most (but not all) age-gated content can be downloaded without cookies * Most (but not all) age-gated content can be downloaded without cookies
* Partial workaround for throttling issue * Fix for [n-sig based throttling](https://github.com/ytdl-org/youtube-dl/issues/29326)
* Redirect channel's home URL automatically to `/video` to preserve the old behaviour * Redirect channel's home URL automatically to `/video` to preserve the old behaviour
* `255kbps` audio is extracted (if available) from youtube music when premium cookies are given * `255kbps` audio is extracted (if available) from youtube music when premium cookies are given
* Youtube music Albums, channels etc can be downloaded ([except self-uploaded music](https://github.com/yt-dlp/yt-dlp/issues/723)) * Youtube music Albums, channels etc can be downloaded ([except self-uploaded music](https://github.com/yt-dlp/yt-dlp/issues/723))
@ -154,7 +154,7 @@ # INSTALLATION
You can install yt-dlp using one of the following methods: You can install yt-dlp using one of the following methods:
#### Using the release binary ### Using the release binary
You can simply download the [correct binary file](#release-files) for your OS: **[[Windows](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe)] [[UNIX-like](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp)]** You can simply download the [correct binary file](#release-files) for your OS: **[[Windows](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe)] [[UNIX-like](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp)]**
@ -177,7 +177,7 @@ #### Using the release binary
PS: The manpages, shell completion files etc. are available in [yt-dlp.tar.gz](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.tar.gz) PS: The manpages, shell completion files etc. are available in [yt-dlp.tar.gz](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.tar.gz)
#### With [PIP](https://pypi.org/project/pip) ### With [PIP](https://pypi.org/project/pip)
You can install the [PyPI package](https://pypi.org/project/yt-dlp) with: You can install the [PyPI package](https://pypi.org/project/yt-dlp) with:
``` ```
@ -196,7 +196,7 @@ #### With [PIP](https://pypi.org/project/pip)
Note that on some systems, you may need to use `py` or `python` instead of `python3` Note that on some systems, you may need to use `py` or `python` instead of `python3`
#### With [Homebrew](https://brew.sh) ### With [Homebrew](https://brew.sh)
macOS or Linux users that are using Homebrew can also install it by: macOS or Linux users that are using Homebrew can also install it by:
@ -204,14 +204,14 @@ #### With [Homebrew](https://brew.sh)
brew install yt-dlp/taps/yt-dlp brew install yt-dlp/taps/yt-dlp
``` ```
### UPDATE ## UPDATE
You can use `yt-dlp -U` to update if you are [using the provided release](#using-the-release-binary) You can use `yt-dlp -U` to update if you are [using the provided release](#using-the-release-binary)
If you [installed with pip](#with-pip), simply re-run the same command that was used to install the program If you [installed with pip](#with-pip), simply re-run the same command that was used to install the program
If you [installed using Homebrew](#with-homebrew), run `brew upgrade yt-dlp/taps/yt-dlp` If you [installed using Homebrew](#with-homebrew), run `brew upgrade yt-dlp/taps/yt-dlp`
### RELEASE FILES ## RELEASE FILES
#### Recommended #### Recommended
@ -238,7 +238,7 @@ #### Misc
[SHA2-512SUMS](https://github.com/yt-dlp/yt-dlp/releases/latest/download/SHA2-512SUMS)|GNU-style SHA512 sums [SHA2-512SUMS](https://github.com/yt-dlp/yt-dlp/releases/latest/download/SHA2-512SUMS)|GNU-style SHA512 sums
[SHA2-256SUMS](https://github.com/yt-dlp/yt-dlp/releases/latest/download/SHA2-256SUMS)|GNU-style SHA256 sums [SHA2-256SUMS](https://github.com/yt-dlp/yt-dlp/releases/latest/download/SHA2-256SUMS)|GNU-style SHA256 sums
### DEPENDENCIES ## DEPENDENCIES
Python versions 3.6+ (CPython and PyPy) are supported. Other versions and implementations may or may not work correctly. Python versions 3.6+ (CPython and PyPy) are supported. Other versions and implementations may or may not work correctly.
<!-- Python 3.5+ uses VC++14 and it is already embedded in the binary created <!-- Python 3.5+ uses VC++14 and it is already embedded in the binary created
@ -266,7 +266,7 @@ ### DEPENDENCIES
**Note**: There are some regressions in newer ffmpeg versions that causes various issues when used alongside yt-dlp. Since ffmpeg is such an important dependancy, we provide [custom builds](https://github.com/yt-dlp/FFmpeg-Builds/wiki/Latest#latest-autobuilds) with patches for these issues at [yt-dlp/FFmpeg-Builds](https://github.com/yt-dlp/FFmpeg-Builds). See [the readme](https://github.com/yt-dlp/FFmpeg-Builds#patches-applied) for details on the specifc issues solved by these builds **Note**: There are some regressions in newer ffmpeg versions that causes various issues when used alongside yt-dlp. Since ffmpeg is such an important dependancy, we provide [custom builds](https://github.com/yt-dlp/FFmpeg-Builds/wiki/Latest#latest-autobuilds) with patches for these issues at [yt-dlp/FFmpeg-Builds](https://github.com/yt-dlp/FFmpeg-Builds). See [the readme](https://github.com/yt-dlp/FFmpeg-Builds#patches-applied) for details on the specifc issues solved by these builds
### COMPILE ## COMPILE
**For Windows**: **For Windows**:
To build the Windows executable, you must have pyinstaller (and optionally mutagen, pycryptodomex, websockets). Once you have all the necessary dependencies installed, (optionally) build lazy extractors using `devscripts/make_lazy_extractors.py`, and then just run `pyinst.py`. The executable will be built for the same architecture (32/64 bit) as the python used to build it. To build the Windows executable, you must have pyinstaller (and optionally mutagen, pycryptodomex, websockets). Once you have all the necessary dependencies installed, (optionally) build lazy extractors using `devscripts/make_lazy_extractors.py`, and then just run `pyinst.py`. The executable will be built for the same architecture (32/64 bit) as the python used to build it.
@ -754,7 +754,7 @@ ## Subtitle Options:
"ass/srt/best" "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. be regex) or "all" separated by commas.
(Eg: --sub-langs en.*,ja) You can prefix (Eg: --sub-langs "en.*,ja") You can prefix
the language code with a "-" to exempt it the language code with a "-" to exempt it
from the requested languages. (Eg: --sub- from the requested languages. (Eg: --sub-
langs all,-live_chat) Use --list-subs for a langs all,-live_chat) Use --list-subs for a
@ -989,7 +989,7 @@ # CONFIGURATION
* `~/yt-dlp.conf` * `~/yt-dlp.conf`
* `~/yt-dlp.conf.txt` * `~/yt-dlp.conf.txt`
`%XDG_CONFIG_HOME%` defaults to `~/.config` if undefined. On windows, `~` points to %HOME% if present, `%USERPROFILE%` (generally `C:\Users\<user name>`) or `%HOMEDRIVE%%HOMEPATH%`. `%XDG_CONFIG_HOME%` defaults to `~/.config` if undefined. On windows, `%APPDATA%` generally points to (`C:\Users\<user name>\AppData\Roaming`) and `~` points to `%HOME%` if present, `%USERPROFILE%` (generally `C:\Users\<user name>`), or `%HOMEDRIVE%%HOMEPATH%`
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: 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:
@ -1011,7 +1011,7 @@ # Save all videos under YouTube directory in your home directory
Note that options in configuration file are just the same options aka switches used in regular command line calls; thus there **must be no whitespace** after `-` or `--`, e.g. `-o` or `--proxy` but not `- o` or `-- proxy`. Note that options in configuration file are just the same options aka switches used in regular command line calls; thus there **must be no whitespace** after `-` or `--`, e.g. `-o` or `--proxy` but not `- o` or `-- proxy`.
You can use `--ignore-config` if you want to disable all configuration files for a particular yt-dlp run. If `--ignore-config` is found inside any configuration file, no further configuration will be loaded. For example, having the option in the portable configuration file prevents loading of user and system configurations. Additionally, (for backward compatibility) if `--ignore-config` is found inside the system configuration file, the user configuration is not loaded. You can use `--ignore-config` if you want to disable all configuration files for a particular yt-dlp run. If `--ignore-config` is found inside any configuration file, no further configuration will be loaded. For example, having the option in the portable configuration file prevents loading of home, user, and system configurations. Additionally, (for backward compatibility) if `--ignore-config` is found inside the system configuration file, the user configuration is not loaded.
### Authentication with `.netrc` file ### Authentication with `.netrc` file
@ -1478,7 +1478,7 @@ # preferring better codec and then larger total bitrate for the same resolution
# MODIFYING METADATA # MODIFYING METADATA
The metadata obtained the the extractors can be modified by using `--parse-metadata` and `--replace-in-metadata` The metadata obtained by the extractors can be modified by using `--parse-metadata` and `--replace-in-metadata`
`--replace-in-metadata FIELDS REGEX REPLACE` is used to replace text in any metadata field using [python regular expression](https://docs.python.org/3/library/re.html#regular-expression-syntax). [Backreferences](https://docs.python.org/3/library/re.html?highlight=backreferences#re.sub) can be used in the replace string for advanced use. `--replace-in-metadata FIELDS REGEX REPLACE` is used to replace text in any metadata field using [python regular expression](https://docs.python.org/3/library/re.html#regular-expression-syntax). [Backreferences](https://docs.python.org/3/library/re.html?highlight=backreferences#re.sub) can be used in the replace string for advanced use.

View File

@ -3209,7 +3209,7 @@ def list_formats(self, info_dict):
self._format_screen(format_field(f, 'format_id'), self.Styles.ID), self._format_screen(format_field(f, 'format_id'), self.Styles.ID),
format_field(f, 'ext'), format_field(f, 'ext'),
self.format_resolution(f), self.format_resolution(f),
format_field(f, 'fps', '%d'), format_field(f, 'fps', '%3d'),
format_field(f, 'dynamic_range', '%s', ignore=(None, 'SDR')).replace('HDR', ''), format_field(f, 'dynamic_range', '%s', ignore=(None, 'SDR')).replace('HDR', ''),
delim, delim,
format_field(f, 'filesize', ' %s', func=format_bytes) + format_field(f, 'filesize_approx', '~%s', func=format_bytes), format_field(f, 'filesize', ' %s', func=format_bytes) + format_field(f, 'filesize_approx', '~%s', func=format_bytes),
@ -3353,7 +3353,7 @@ def python_implementation():
exe_versions, ffmpeg_features = FFmpegPostProcessor.get_versions_and_features(self) exe_versions, ffmpeg_features = FFmpegPostProcessor.get_versions_and_features(self)
ffmpeg_features = {key for key, val in ffmpeg_features.items() if val} ffmpeg_features = {key for key, val in ffmpeg_features.items() if val}
if ffmpeg_features: if ffmpeg_features:
exe_versions['ffmpeg'] += f' (%s)' % ','.join(ffmpeg_features) exe_versions['ffmpeg'] += ' (%s)' % ','.join(ffmpeg_features)
exe_versions['rtmpdump'] = rtmpdump_version() exe_versions['rtmpdump'] = rtmpdump_version()
exe_versions['phantomjs'] = PhantomJSwrapper._version() exe_versions['phantomjs'] = PhantomJSwrapper._version()

View File

@ -319,7 +319,9 @@ def report_progress(self, s):
msg_template = '%(_downloaded_bytes_str)s at %(_speed_str)s' msg_template = '%(_downloaded_bytes_str)s at %(_speed_str)s'
else: else:
msg_template = '%(_percent_str)s % at %(_speed_str)s ETA %(_eta_str)s' msg_template = '%(_percent_str)s % at %(_speed_str)s ETA %(_eta_str)s'
if s.get('fragment_index'): if s.get('fragment_index') and s.get('fragment_count'):
msg_template += ' (frag %(fragment_index)s/%(fragment_count)s)'
elif s.get('fragment_index'):
msg_template += ' (frag %(fragment_index)s)' msg_template += ' (frag %(fragment_index)s)'
s['_default_template'] = msg_template % s s['_default_template'] = msg_template % s
self._report_progress_status(s) self._report_progress_status(s)

View File

@ -111,7 +111,7 @@ def _real_extract(self, url):
vod_info = self._parse_json( vod_info = self._parse_json(
self._search_regex( self._search_regex(
r'(?s)#vod-player["\']\s*,\s*(\{.+?\})\s*\)', webpage, r'(?s)#vod-player["\']\s*,\s*(\{.+?\})\s*\)', webpage,
video_id), 'vod player'),
video_id, transform_source=js_to_json) video_id, transform_source=js_to_json)
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(

View File

@ -2513,7 +2513,7 @@ def _extract_formats(self, streaming_data, video_id, player_url, is_live):
fmt.get('qualityLabel') or quality.replace('audio_quality_', ''), fmt.get('qualityLabel') or quality.replace('audio_quality_', ''),
throttled and 'THROTTLED'))), throttled and 'THROTTLED'))),
'source_preference': -10 if not throttled else -1, 'source_preference': -10 if not throttled else -1,
'fps': int_or_none(fmt.get('fps')), 'fps': int_or_none(fmt.get('fps')) or None,
'height': height, 'height': height,
'quality': q(quality), 'quality': q(quality),
'tbr': tbr, 'tbr': tbr,

View File

@ -634,7 +634,7 @@ def _dict_from_options_callback(
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. (Eg: --sub-langs "en.*,ja") '
'You can prefix the language code with a "-" to exempt it from the requested languages. (Eg: --sub-langs all,-live_chat) ' 'You can prefix the language code with a "-" to exempt it from the requested languages. (Eg: --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'))