[cleanup] Misc

This commit is contained in:
pukkandan 2021-09-05 11:16:23 +05:30
parent e04a1ff92e
commit 526d74ec5a
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
7 changed files with 10 additions and 12 deletions

View File

@ -30,7 +30,7 @@
* The fetched sponsor sections are written to the infojson * The fetched sponsor sections are written to the infojson
* Deprecates: `--sponskrub`, `--no-sponskrub`, `--sponskrub-cut`, `--no-sponskrub-cut`, `--sponskrub-force`, `--no-sponskrub-force`, `--sponskrub-location`, `--sponskrub-args` * Deprecates: `--sponskrub`, `--no-sponskrub`, `--sponskrub-cut`, `--no-sponskrub-cut`, `--sponskrub-force`, `--no-sponskrub-force`, `--sponskrub-location`, `--sponskrub-args`
* Split `--embed-chapters` from `--embed-metadata` (it still implies the former by default) * Split `--embed-chapters` from `--embed-metadata` (it still implies the former by default)
* Add option `--remove-chapters` to remove arbitrary chapters by [nihil-admirari](https://github.com/nihil-admirari), pukkandan * Add option `--remove-chapters` to remove arbitrary chapters by [nihil-admirari](https://github.com/nihil-admirari), [pukkandan](https://github.com/pukkandan)
* Add option `--force-keyframes-at-cuts` for more accurate cuts when removing and splitting chapters by [nihil-admirari](https://github.com/nihil-admirari) * Add option `--force-keyframes-at-cuts` for more accurate cuts when removing and splitting chapters by [nihil-admirari](https://github.com/nihil-admirari)
* Let `--match-filter` reject entries early * Let `--match-filter` reject entries early
* Makes redundant: `--match-title`, `--reject-title`, `--min-views`, `--max-views` * Makes redundant: `--match-title`, `--reject-title`, `--min-views`, `--max-views`

View File

@ -966,7 +966,7 @@ To summarize, the general syntax for a field is:
%(name[.keys][addition][>strf][|default])[flags][width][.precision][length]type %(name[.keys][addition][>strf][|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`, `infojson`, `pl_thumbnail`, `pl_description`, `pl_infojson`, `chapter`. For example, `-o '%(title)s.%(ext)s' -o 'thumbnail:%(title)s\%(title)s.%(ext)s'` will put the thumbnails in a folder with the same name as the video. Additionally, you can set different output templates for the various metadata files separately from the general output template by specifying the type of file followed by the template separated by a colon `:`. The different file types supported are `subtitle`, `thumbnail`, `description`, `annotation` (deprecated), `infojson`, `pl_thumbnail`, `pl_description`, `pl_infojson`, `chapter`. For example, `-o '%(title)s.%(ext)s' -o 'thumbnail:%(title)s\%(title)s.%(ext)s'` will put the thumbnails in a folder with the same name as the video.
The available fields are: The available fields are:

View File

@ -123,7 +123,7 @@ def _extract_firefox_cookies(profile, logger):
cookie_database_path = _find_most_recently_used_file(search_root, 'cookies.sqlite') cookie_database_path = _find_most_recently_used_file(search_root, 'cookies.sqlite')
if cookie_database_path is None: if cookie_database_path is None:
raise FileNotFoundError('could not find firefox cookies database in {}'.format(search_root)) raise FileNotFoundError('could not find firefox cookies database in {}'.format(search_root))
logger.debug('extracting from: "{}"'.format(cookie_database_path)) logger.debug('Extracting cookies from: "{}"'.format(cookie_database_path))
with tempfile.TemporaryDirectory(prefix='youtube_dl') as tmpdir: with tempfile.TemporaryDirectory(prefix='youtube_dl') as tmpdir:
cursor = None cursor = None
@ -240,7 +240,7 @@ def _extract_chrome_cookies(browser_name, profile, logger):
cookie_database_path = _find_most_recently_used_file(search_root, 'Cookies') cookie_database_path = _find_most_recently_used_file(search_root, 'Cookies')
if cookie_database_path is None: if cookie_database_path is None:
raise FileNotFoundError('could not find {} cookies database in "{}"'.format(browser_name, search_root)) raise FileNotFoundError('could not find {} cookies database in "{}"'.format(browser_name, search_root))
logger.debug('extracting from: "{}"'.format(cookie_database_path)) logger.debug('Extracting cookies from: "{}"'.format(cookie_database_path))
decryptor = get_cookie_decryptor(config['browser_dir'], config['keyring_name'], logger) decryptor = get_cookie_decryptor(config['browser_dir'], config['keyring_name'], logger)

View File

@ -23,7 +23,6 @@ from ..utils import (
int_or_none, int_or_none,
KNOWN_EXTENSIONS, KNOWN_EXTENSIONS,
mimetype2ext, mimetype2ext,
network_exceptions,
remove_end, remove_end,
parse_qs, parse_qs,
str_or_none, str_or_none,
@ -711,7 +710,6 @@ class SoundcloudPagedPlaylistBaseIE(SoundcloudIE):
query.pop('offset', None) query.pop('offset', None)
class SoundcloudUserIE(SoundcloudPagedPlaylistBaseIE): class SoundcloudUserIE(SoundcloudPagedPlaylistBaseIE):
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
https?:// https?://

View File

@ -132,9 +132,9 @@ class TikTokIE(InfoExtractor):
class TikTokUserIE(InfoExtractor): class TikTokUserIE(InfoExtractor):
IE_NAME = 'tiktok:user' IE_NAME = 'tiktok:user'
_VALID_URL = r'(?!.*/video/)https?://www\.tiktok\.com/@(?P<id>[\w\._]+)' _VALID_URL = r'https?://(?:www\.)?tiktok\.com/@(?P<id>[\w\._]+)/?(?:$|[#?])'
_TESTS = [{ _TESTS = [{
'url': 'https://www.tiktok.com/@corgibobaa?lang=en', 'url': 'https://tiktok.com/@corgibobaa?lang=en',
'playlist_mincount': 45, 'playlist_mincount': 45,
'info_dict': { 'info_dict': {
'id': '6935371178089399301', 'id': '6935371178089399301',
@ -196,7 +196,7 @@ class TikTokUserIE(InfoExtractor):
'Referer': video_url, 'Referer': video_url,
} }
} }
if not data_json['hasMore']: if not data_json.get('hasMore'):
break break
cursor = data_json['cursor'] cursor = data_json['cursor']

View File

@ -803,7 +803,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
# We also want to catch all other network exceptions since errors in later pages can be troublesome # We also want to catch all other network exceptions since errors in later pages can be troublesome
# See https://github.com/yt-dlp/yt-dlp/issues/507#issuecomment-880188210 # See https://github.com/yt-dlp/yt-dlp/issues/507#issuecomment-880188210
if not isinstance(e.cause, compat_HTTPError) or e.cause.code not in (403, 429): if not isinstance(e.cause, compat_HTTPError) or e.cause.code not in (403, 429):
last_error = error_to_compat_str(e.cause or e) last_error = error_to_compat_str(e.cause or e.msg)
if count < retries: if count < retries:
continue continue
if fatal: if fatal:

View File

@ -2408,7 +2408,7 @@ class ExtractorError(YoutubeDLError):
if sys.exc_info()[0] in network_exceptions: if sys.exc_info()[0] in network_exceptions:
expected = True expected = True
self.msg = msg self.msg = str(msg)
self.traceback = tb self.traceback = tb
self.expected = expected self.expected = expected
self.cause = cause self.cause = cause
@ -2419,7 +2419,7 @@ class ExtractorError(YoutubeDLError):
super(ExtractorError, self).__init__(''.join(( super(ExtractorError, self).__init__(''.join((
format_field(ie, template='[%s] '), format_field(ie, template='[%s] '),
format_field(video_id, template='%s: '), format_field(video_id, template='%s: '),
msg, self.msg,
format_field(cause, template=' (caused by %r)'), format_field(cause, template=' (caused by %r)'),
'' if expected else bug_reports_message()))) '' if expected else bug_reports_message())))