[docs,cleanup] Improve docs and minor cleanup

Closes #1387, #1404, #1408, #1485, #1415, #1450, #1492
This commit is contained in:
pukkandan
2021-10-31 14:45:59 +05:30
parent a0bb6ce58d
commit 0930b11fda
10 changed files with 93 additions and 66 deletions

View File

@@ -214,8 +214,8 @@ class YoutubeDL(object):
ignore_no_formats_error: Ignore "No video formats" error. Usefull for
extracting metadata even if the video is not actually
available for download (experimental)
format_sort: How to sort the video formats. see "Sorting Formats"
for more details.
format_sort: A list of fields by which to sort the video formats.
See "Sorting Formats" for more details.
format_sort_force: Force the given format_sort. see "Sorting Formats"
for more details.
allow_multiple_video_streams: Allow multiple video streams to be merged

View File

@@ -225,6 +225,7 @@ def _real_main(argv=None):
if opts.playlistend not in (-1, None) and opts.playlistend < opts.playliststart:
raise ValueError('Playlist end must be greater than playlist start')
if opts.extractaudio:
opts.audioformat = opts.audioformat.lower()
if opts.audioformat not in ['best'] + list(FFmpegExtractAudioPP.SUPPORTED_EXTS):
parser.error('invalid audio format specified')
if opts.audioquality:

View File

@@ -117,7 +117,7 @@ def _extract_firefox_cookies(profile, logger):
raise FileNotFoundError('could not find firefox cookies database in {}'.format(search_root))
logger.debug('Extracting cookies from: "{}"'.format(cookie_database_path))
with tempfile.TemporaryDirectory(prefix='youtube_dl') as tmpdir:
with tempfile.TemporaryDirectory(prefix='yt_dlp') as tmpdir:
cursor = None
try:
cursor = _open_database_copy(cookie_database_path, tmpdir)
@@ -236,7 +236,7 @@ def _extract_chrome_cookies(browser_name, profile, logger):
decryptor = get_cookie_decryptor(config['browser_dir'], config['keyring_name'], logger)
with tempfile.TemporaryDirectory(prefix='youtube_dl') as tmpdir:
with tempfile.TemporaryDirectory(prefix='yt_dlp') as tmpdir:
cursor = None
try:
cursor = _open_database_copy(cookie_database_path, tmpdir)

View File

@@ -441,11 +441,11 @@ class InfoExtractor(object):
_WORKING = True
_LOGIN_HINTS = {
'any': 'Use --cookies, --username and --password or --netrc to provide account credentials',
'any': 'Use --cookies, --username and --password, or --netrc to provide account credentials',
'cookies': (
'Use --cookies-from-browser or --cookies for the authentication. '
'See https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl for how to manually pass cookies'),
'password': 'Use --username and --password or --netrc to provide account credentials',
'password': 'Use --username and --password, or --netrc to provide account credentials',
}
def __init__(self, downloader=None):

View File

@@ -1,4 +1,4 @@
# coding=utf-8
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor

View File

@@ -38,8 +38,8 @@ class TikTokBaseIE(InfoExtractor):
'build_number': self._APP_VERSION,
'manifest_version_code': self._MANIFEST_APP_VERSION,
'update_version_code': self._MANIFEST_APP_VERSION,
'openudid': ''.join(random.choice('0123456789abcdef') for i in range(16)),
'uuid': ''.join([random.choice(string.digits) for num in range(16)]),
'openudid': ''.join(random.choice('0123456789abcdef') for _ in range(16)),
'uuid': ''.join([random.choice(string.digits) for _ in range(16)]),
'_rticket': int(time.time() * 1000),
'ts': int(time.time()),
'device_brand': 'Google',
@@ -66,7 +66,7 @@ class TikTokBaseIE(InfoExtractor):
'as': 'a1qwert123',
'cp': 'cbfhckdckkde1',
}
self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choice('0123456789abcdef') for i in range(160)))
self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choice('0123456789abcdef') for _ in range(160)))
return self._download_json(
'https://%s/aweme/v1/%s/' % (self._API_HOSTNAME, ep), video_id=video_id,
fatal=fatal, note=note, errnote=errnote, headers={
@@ -416,7 +416,7 @@ class TikTokUserIE(TikTokBaseIE):
'max_cursor': 0,
'min_cursor': 0,
'retry_type': 'no_retry',
'device_id': ''.join(random.choice(string.digits) for i in range(19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
'device_id': ''.join(random.choice(string.digits) for _ in range(19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
}
max_retries = self.get_param('extractor_retries', 3)

View File

@@ -209,7 +209,7 @@ def parseOpts(overrideArguments=None):
general.add_option(
'-i', '--ignore-errors',
action='store_true', dest='ignoreerrors',
help='Ignore download and postprocessing errors. The download will be considered successfull even if the postprocessing fails')
help='Ignore download and postprocessing errors. The download will be considered successful even if the postprocessing fails')
general.add_option(
'--no-abort-on-error',
action='store_const', dest='ignoreerrors', const='only_download',
@@ -383,7 +383,7 @@ def parseOpts(overrideArguments=None):
'--date',
metavar='DATE', dest='date', default=None,
help=(
'Download only videos uploaded in this date. '
'Download only videos uploaded on this date. '
'The date can be "YYYYMMDD" or in the format '
'"(now|today)[+-][0-9](day|week|month|year)(s)?"'))
selection.add_option(
@@ -840,7 +840,7 @@ def parseOpts(overrideArguments=None):
'--ignore-no-formats-error',
action='store_true', dest='ignore_no_formats_error', default=False,
help=(
'Ignore "No video formats" error. Usefull for extracting metadata '
'Ignore "No video formats" error. Useful for extracting metadata '
'even if the videos are not actually available for download (experimental)'))
verbosity.add_option(
'--no-ignore-no-formats-error',
@@ -935,7 +935,7 @@ def parseOpts(overrideArguments=None):
'Template for progress outputs, optionally prefixed with one of "download:" (default), '
'"download-title:" (the console title), "postprocess:", or "postprocess-title:". '
'The video\'s fields are accessible under the "info" key and '
'the progress attributes are accessible under "progress" key. Eg: '
'the progress attributes are accessible under "progress" key. E.g.: '
# TODO: Document the fields inside "progress"
'--console-title --progress-template "download-title:%(info.id)s-%(progress.eta)s"'))
verbosity.add_option(
@@ -1028,11 +1028,11 @@ def parseOpts(overrideArguments=None):
filesystem.add_option(
'--windows-filenames',
action='store_true', dest='windowsfilenames', default=False,
help='Force filenames to be windows compatible')
help='Force filenames to be Windows-compatible')
filesystem.add_option(
'--no-windows-filenames',
action='store_false', dest='windowsfilenames',
help='Make filenames windows compatible only if using windows (default)')
help='Make filenames Windows-compatible only if using Windows (default)')
filesystem.add_option(
'--trim-filenames', '--trim-file-names', metavar='LENGTH',
dest='trim_file_name', default=0, type=int,