]> jfr.im git - yt-dlp.git/commitdiff
[cleanup] Misc
authorpukkandan <redacted>
Thu, 6 Jul 2023 14:39:42 +0000 (20:09 +0530)
committerpukkandan <redacted>
Thu, 6 Jul 2023 16:09:55 +0000 (21:39 +0530)
devscripts/make_changelog.py
setup.cfg
yt_dlp/YoutubeDL.py
yt_dlp/downloader/common.py
yt_dlp/downloader/fragment.py
yt_dlp/extractor/adobepass.py
yt_dlp/extractor/iqiyi.py
yt_dlp/extractor/vshare.py
yt_dlp/extractor/youtube.py
yt_dlp/utils/__init__.py

index eb0e3082f9f045a50b9c3109bafe5f64db26f00f..3ad4c5408b11fb09c07f1bfaa6c9393944316afa 100644 (file)
@@ -55,6 +55,7 @@ def commit_lookup(cls):
                     'dependencies',
                     'jsinterp',
                     'outtmpl',
+                    'formats',
                     'plugins',
                     'update',
                     'upstream',
@@ -68,9 +69,9 @@ def commit_lookup(cls):
                     'misc',
                     'test',
                 },
-                cls.EXTRACTOR: {'extractor'},
-                cls.DOWNLOADER: {'downloader'},
-                cls.POSTPROCESSOR: {'postprocessor'},
+                cls.EXTRACTOR: {'extractor', 'ie'},
+                cls.DOWNLOADER: {'downloader', 'fd'},
+                cls.POSTPROCESSOR: {'postprocessor', 'pp'},
             }.items()
             for name in names
         }
index 68d9e516d16cc120a7fe6fecaf38b884d0e6c570..6deaa797151bfc3ee2eb0cff6ad65532087e51c7 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -8,7 +8,6 @@ ignore = E402,E501,E731,E741,W503
 max_line_length = 120
 per_file_ignores =
     devscripts/lazy_load_template.py: F401
-    yt_dlp/utils/__init__.py: F401, F403
 
 
 [autoflake]
index d4aff0743e64a8a15756e81c510ebbf1e8b0fb5e..448a15bc954c5f0585d9377e0bd8ef515d8c32a0 100644 (file)
@@ -3687,7 +3687,7 @@ def render_formats_table(self, info_dict):
 
         def simplified_codec(f, field):
             assert field in ('acodec', 'vcodec')
-            codec = f.get(field, 'unknown')
+            codec = f.get(field)
             if not codec:
                 return 'unknown'
             elif codec != 'none':
index a0219a35098b60cd745e62482790f081b5cdf0c9..8fe9d999300f8b9d2430723b8f02729854caf3a5 100644 (file)
@@ -255,7 +255,8 @@ def sanitize_open(self, filename, open_mode):
 
     @wrap_file_access('remove')
     def try_remove(self, filename):
-        os.remove(filename)
+        if os.path.isfile(filename):
+            os.remove(filename)
 
     @wrap_file_access('rename')
     def try_rename(self, old_filename, new_filename):
index 458167216cd6c5bc02c4d345f48393a619f2de13..06981532694f370efcf05fbe1e94b9fb9bec5aff 100644 (file)
@@ -300,9 +300,7 @@ def frag_progress_hook(s):
     def _finish_frag_download(self, ctx, info_dict):
         ctx['dest_stream'].close()
         if self.__do_ytdl_file(ctx):
-            ytdl_filename = encodeFilename(self.ytdl_filename(ctx['filename']))
-            if os.path.isfile(ytdl_filename):
-                self.try_remove(ytdl_filename)
+            self.try_remove(self.ytdl_filename(ctx['filename']))
         elapsed = time.time() - ctx['started']
 
         to_file = ctx['tmpfilename'] != '-'
index 68a970f68c6c7e701245d0b9726b12495261e11c..722a534ed6c3db2f4101411474a3f86e87ffa6ed 100644 (file)
@@ -1473,7 +1473,7 @@ def extract_redirect_url(html, url=None, fatal=False):
                     elif 'automatically signed in with' in provider_redirect_page:
                         # Seems like comcast is rolling up new way of automatically signing customers
                         oauth_redirect_url = self._html_search_regex(
-                            r'continue:\s*"(https://oauth.xfinity.com/oauth/authorize\?.+)"', provider_redirect_page,
+                            r'continue:\s*"(https://oauth\.xfinity\.com/oauth/authorize\?.+)"', provider_redirect_page,
                             'oauth redirect (signed)')
                         # Just need to process the request. No useful data comes back
                         self._download_webpage(oauth_redirect_url, video_id, 'Confirming auto login')
index ebf49e8359f2e2fe972e36f1608d6c28220d030e..fa602ba8871aa78377b4998784f85d767e821517 100644 (file)
@@ -527,7 +527,7 @@ def _extract_vms_player_js(self, webpage, video_id):
         if player_js_cache:
             return player_js_cache
         webpack_js_url = self._proto_relative_url(self._search_regex(
-            r'<script src="((?:https?)?//stc.iqiyipic.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
+            r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
         webpack_js = self._download_webpage(webpack_js_url, video_id, note='Downloading webpack JS', errnote='Unable to download webpack JS')
         webpack_map = self._search_json(
             r'["\']\s*\+\s*', webpack_js, 'JS locations', video_id,
index 1bc7ae4ba121a26b469264b2113ab7977ddd442f..443ed43cc46c4aee022a50a6ab6bd0f9fd84c399 100644 (file)
@@ -22,7 +22,7 @@ def _extract_packed(self, webpage):
         packed = self._search_regex(
             r'(eval\(function.+)', webpage, 'packed code')
         unpacked = decode_packed_codes(packed)
-        digits = self._search_regex(r'\[((?:\d+,?)+)\]', unpacked, 'digits')
+        digits = self._search_regex(r'\[([\d,]+)\]', unpacked, 'digits')
         digits = [int(digit) for digit in digits.split(',')]
         key_digit = self._search_regex(
             r'fromCharCode\(.+?(\d+)\)}', unpacked, 'key digit')
index 552ca099c479c579a4b8d84a1b18245996c37350..2a8106b45cf0c6ab991ac0f2ded1c459809e669c 100644 (file)
@@ -3117,7 +3117,7 @@ def _extract_n_function_name(self, jscode):
             return funcname
 
         return json.loads(js_to_json(self._search_regex(
-            rf'var {re.escape(funcname)}\s*=\s*(\[.+?\])[,;]', jscode,
+            rf'var {re.escape(funcname)}\s*=\s*(\[.+?\])\s*[,;]', jscode,
             f'Initial JS player n function list ({funcname}.{idx})')))[int(idx)]
 
     def _extract_n_function_code(self, video_id, player_url):
index 74b39e2c7b78dc5ba72b485260d08370bdf080fc..2dd20ada25deeda4c7f39d4c33345308e9b83991 100644 (file)
@@ -1,3 +1,4 @@
+# flake8: noqa: F401, F403
 import warnings
 
 from ..compat.compat_utils import passthrough_module