[cleanup, docs] Minor fixes

Closes #2230
This commit is contained in:
pukkandan 2022-01-12 09:00:21 +05:30
parent 397235c52b
commit ed8d87f911
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
6 changed files with 16 additions and 14 deletions

View file

@ -1392,10 +1392,10 @@ ## Sorting Formats
- `hasvid`: Gives priority to formats that has a video stream - `hasvid`: Gives priority to formats that has a video stream
- `hasaud`: Gives priority to formats that has a audio stream - `hasaud`: Gives priority to formats that has a audio stream
- `ie_pref`: The format preference as given by the extractor - `ie_pref`: The format preference
- `lang`: Language preference as given by the extractor - `lang`: The language preference
- `quality`: The quality of the format as given by the extractor - `quality`: The quality of the format
- `source`: Preference of the source as given by the extractor - `source`: The preference of the source
- `proto`: Protocol used for download (`https`/`ftps` > `http`/`ftp` > `m3u8_native`/`m3u8` > `http_dash_segments`> `websocket_frag` > `mms`/`rtsp` > `f4f`/`f4m`) - `proto`: Protocol used for download (`https`/`ftps` > `http`/`ftp` > `m3u8_native`/`m3u8` > `http_dash_segments`> `websocket_frag` > `mms`/`rtsp` > `f4f`/`f4m`)
- `vcodec`: Video Codec (`av01` > `vp9.2` > `vp9` > `h265` > `h264` > `vp8` > `h263` > `theora` > other) - `vcodec`: Video Codec (`av01` > `vp9.2` > `vp9` > `h265` > `h264` > `vp8` > `h263` > `theora` > other)
- `acodec`: Audio Codec (`flac`/`alac` > `wav`/`aiff` > `opus` > `vorbis` > `aac` > `mp4a` > `mp3` > `eac3` > `ac3` > `dts` > other) - `acodec`: Audio Codec (`flac`/`alac` > `wav`/`aiff` > `opus` > `vorbis` > `aac` > `mp4a` > `mp3` > `eac3` > `ac3` > `dts` > other)
@ -1687,7 +1687,7 @@ # EMBEDDING YT-DLP
ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc']) ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
``` ```
Most likely, you'll want to use various options. For a list of options available, have a look at [`yt_dlp/YoutubeDL.py`](yt_dlp/YoutubeDL.py#L162). Most likely, you'll want to use various options. For a list of options available, have a look at [`yt_dlp/YoutubeDL.py`](yt_dlp/YoutubeDL.py#L191).
Here's a more complete example demonstrating various functionality: Here's a more complete example demonstrating various functionality:

View file

@ -1637,7 +1637,7 @@ def iter_playlistitems(format):
ie_entries = ie_result['entries'] ie_entries = ie_result['entries']
if isinstance(ie_entries, list): if isinstance(ie_entries, list):
playlist_count = len(ie_result) playlist_count = len(ie_entries)
msg = f'Collected {playlist_count} videos; downloading %d of them' msg = f'Collected {playlist_count} videos; downloading %d of them'
ie_result['playlist_count'] = ie_result.get('playlist_count') or playlist_count ie_result['playlist_count'] = ie_result.get('playlist_count') or playlist_count
@ -2392,15 +2392,15 @@ def sanitize_numeric_fields(info):
if not self.params.get('allow_unplayable_formats'): if not self.params.get('allow_unplayable_formats'):
formats = [f for f in formats if not f.get('has_drm')] formats = [f for f in formats if not f.get('has_drm')]
# backward compatibility
info_dict['fulltitle'] = info_dict['title']
if info_dict.get('is_live'): if info_dict.get('is_live'):
get_from_start = bool(self.params.get('live_from_start')) get_from_start = bool(self.params.get('live_from_start'))
formats = [f for f in formats if bool(f.get('is_from_start')) == get_from_start] formats = [f for f in formats if bool(f.get('is_from_start')) == get_from_start]
if not get_from_start: if not get_from_start:
info_dict['title'] += ' ' + datetime.datetime.now().strftime('%Y-%m-%d %H:%M') info_dict['title'] += ' ' + datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
# backward compatibility
info_dict['fulltitle'] = info_dict['title']
if not formats: if not formats:
self.raise_no_formats(info_dict) self.raise_no_formats(info_dict)

View file

@ -99,7 +99,7 @@ def _real_extract(self, url):
is_live = 'data-status="online"' in webpage is_live = 'data-status="online"' in webpage
if not traverse_obj(stream_server_data, 'llfmp4') and is_live: if not traverse_obj(stream_server_data, 'llfmp4') and is_live:
raise ExtractorError('You must be logged in to watch.', expected=True) self.raise_login_required(method='cookies')
formats = [] formats = []
if is_live and not m3u8_url: if is_live and not m3u8_url:

View file

@ -262,7 +262,8 @@ def _dict_from_options_callback(
action='store_true', dest='ignoreconfig', action='store_true', dest='ignoreconfig',
help=( help=(
'Don\'t load any more configuration files except those given by --config-locations. ' 'Don\'t load any more configuration files except those given by --config-locations. '
'For backward compatibility, if this option is found inside the system configuration file, the user configuration is not loaded')) 'For backward compatibility, if this option is found inside the system configuration file, the user configuration is not loaded. '
'(Alias: --no-config'))
general.add_option( general.add_option(
'--no-config-locations', '--no-config-locations',
action='store_const', dest='config_locations', const=[], action='store_const', dest='config_locations', const=[],

View file

@ -585,7 +585,7 @@ class FFmpegVideoRemuxerPP(FFmpegVideoConvertorPP):
@staticmethod @staticmethod
def _options(target_ext): def _options(target_ext):
return self.stream_copy_opts() return FFmpegPostProcessor.stream_copy_opts()
class FFmpegEmbedSubtitlePP(FFmpegPostProcessor): class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
@ -678,7 +678,7 @@ def __init__(self, downloader, add_metadata=True, add_chapters=True, add_infojso
@staticmethod @staticmethod
def _options(target_ext): def _options(target_ext):
audio_only = target_ext == 'm4a' audio_only = target_ext == 'm4a'
yield from self.stream_copy_opts(not audio_only) yield from FFmpegPostProcessor.stream_copy_opts(not audio_only)
if audio_only: if audio_only:
yield from ('-vn', '-acodec', 'copy') yield from ('-vn', '-acodec', 'copy')

View file

@ -57,6 +57,7 @@ def run(self, info):
self.write_debug('Expected and actual durations mismatch') self.write_debug('Expected and actual durations mismatch')
concat_opts = self._make_concat_opts(cuts, real_duration) concat_opts = self._make_concat_opts(cuts, real_duration)
self.write_debug('Concat spec = %s' % ', '.join(f'{c.get("inpoint", 0.0)}-{c.get("outpoint", "inf")}' for c in concat_opts))
def remove_chapters(file, is_sub): def remove_chapters(file, is_sub):
return file, self.remove_chapters(file, cuts, concat_opts, self._force_keyframes and not is_sub) return file, self.remove_chapters(file, cuts, concat_opts, self._force_keyframes and not is_sub)
@ -332,6 +333,6 @@ def _make_concat_opts(chapters_to_remove, duration):
continue continue
opts[-1]['outpoint'] = f'{s["start_time"]:.6f}' opts[-1]['outpoint'] = f'{s["start_time"]:.6f}'
# Do not create 0 duration chunk at the end. # Do not create 0 duration chunk at the end.
if s['end_time'] != duration: if s['end_time'] < duration:
opts.append({'inpoint': f'{s["end_time"]:.6f}'}) opts.append({'inpoint': f'{s["end_time"]:.6f}'})
return opts return opts