]> jfr.im git - yt-dlp.git/commitdiff
[cleanup] Misc
authorpukkandan <redacted>
Sun, 5 Sep 2021 05:46:23 +0000 (11:16 +0530)
committerpukkandan <redacted>
Sun, 5 Sep 2021 05:46:23 +0000 (11:16 +0530)
Changelog.md
README.md
yt_dlp/cookies.py
yt_dlp/extractor/soundcloud.py
yt_dlp/extractor/tiktok.py
yt_dlp/extractor/youtube.py
yt_dlp/utils.py

index 9ccc505b717a262d5f8581555403fc5cb22bb9bf..6901e28f2f3397dd4a9d6df411c9c9e6ff8ca071 100644 (file)
@@ -30,7 +30,7 @@ ### 2021.09.02
     * 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`
 * 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)
 * Let `--match-filter` reject entries early
     * Makes redundant: `--match-title`, `--reject-title`, `--min-views`, `--max-views`
index 84974249d4bcc570aa13edf03a6f6ecb0b20398c..2e4bedc938f7cf7a3f2547575b8f7c79eff8b94e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -966,7 +966,7 @@ # OUTPUT TEMPLATE
 %(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:
 
index 74219a8f7c4580dc6267422af8710349277bef6c..bc3bb62f413ce6fd1d29417bdb5f773336d64e8e 100644 (file)
@@ -123,7 +123,7 @@ def _extract_firefox_cookies(profile, logger):
     cookie_database_path = _find_most_recently_used_file(search_root, 'cookies.sqlite')
     if cookie_database_path is None:
         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:
         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')
     if cookie_database_path is None:
         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)
 
index c7078ece6dcff108f00e7c20bd686ce0c91d236a..77e248a477d676a97c45733f19de4d1bc7001eac 100644 (file)
@@ -23,7 +23,6 @@
     int_or_none,
     KNOWN_EXTENSIONS,
     mimetype2ext,
-    network_exceptions,
     remove_end,
     parse_qs,
     str_or_none,
@@ -711,7 +710,6 @@ def resolve_entry(*candidates):
             query.pop('offset', None)
 
 
-
 class SoundcloudUserIE(SoundcloudPagedPlaylistBaseIE):
     _VALID_URL = r'''(?x)
                         https?://
index 08a34db47a07c68e69d4c7e8fa7f3138e4ee17f1..6c50ec7dfdab7538292a3c7da3069bc5b511826f 100644 (file)
@@ -132,9 +132,9 @@ def _real_extract(self, url):
 
 class TikTokUserIE(InfoExtractor):
     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 = [{
-        'url': 'https://www.tiktok.com/@corgibobaa?lang=en',
+        'url': 'https://tiktok.com/@corgibobaa?lang=en',
         'playlist_mincount': 45,
         'info_dict': {
             'id': '6935371178089399301',
@@ -196,7 +196,7 @@ def _entries(self, url, user_id):
                         'Referer': video_url,
                     }
                 }
-            if not data_json['hasMore']:
+            if not data_json.get('hasMore'):
                 break
             cursor = data_json['cursor']
 
index e184cc6a6ea3e3832cad6ca5b7e37326df3c881c..65a6c043e0e19814f996a09a9be328f97b9096c3 100644 (file)
@@ -803,7 +803,7 @@ def _extract_response(self, item_id, query, note='Downloading API JSON', headers
                     # 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
                     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:
                             continue
                 if fatal:
index cdf4c0755bbd629f962a250200ed7b2a6a16f6f9..ce84f741669ee57243b12f6e3dff58d85efd9b72 100644 (file)
@@ -2408,7 +2408,7 @@ def __init__(self, msg, tb=None, expected=False, cause=None, video_id=None, ie=N
         if sys.exc_info()[0] in network_exceptions:
             expected = True
 
-        self.msg = msg
+        self.msg = str(msg)
         self.traceback = tb
         self.expected = expected
         self.cause = cause
@@ -2419,7 +2419,7 @@ def __init__(self, msg, tb=None, expected=False, cause=None, video_id=None, ie=N
         super(ExtractorError, self).__init__(''.join((
             format_field(ie, template='[%s] '),
             format_field(video_id, template='%s: '),
-            msg,
+            self.msg,
             format_field(cause, template=' (caused by %r)'),
             '' if expected else bug_reports_message())))