Skip to content

A feature-rich command-line audio/video downloader

Remove Python 3.9 support (#13861)

bashonly4e6a693057cf
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fda92cea88..e20373ec02 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -558,35 +558,39 @@ jobs:
cat >> _update_spec << EOF
# This file is used for regulating self-update
lock 2022.08.18.36 .+ Python 3\.6
- lock 2023.11.16 (?!win_x86_exe).+ Python 3\.7
+ lock 2023.11.16 zip Python 3\.7
lock 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
lock 2024.10.22 py2exe .+
lock 2024.10.22 zip Python 3\.8
lock 2024.10.22 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2)
lock 2025.08.11 darwin_legacy_exe .+
lock 2025.08.27 linux_armv7l_exe .+
+ lock 2025.10.14 zip Python 3\.9
lockV2 yt-dlp/yt-dlp 2022.08.18.36 .+ Python 3\.6
- lockV2 yt-dlp/yt-dlp 2023.11.16 (?!win_x86_exe).+ Python 3\.7
+ lockV2 yt-dlp/yt-dlp 2023.11.16 zip Python 3\.7
lockV2 yt-dlp/yt-dlp 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
lockV2 yt-dlp/yt-dlp 2024.10.22 py2exe .+
lockV2 yt-dlp/yt-dlp 2024.10.22 zip Python 3\.8
lockV2 yt-dlp/yt-dlp 2024.10.22 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2)
lockV2 yt-dlp/yt-dlp 2025.08.11 darwin_legacy_exe .+
lockV2 yt-dlp/yt-dlp 2025.08.27 linux_armv7l_exe .+
- lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 (?!win_x86_exe).+ Python 3\.7
+ lockV2 yt-dlp/yt-dlp 2025.10.14 zip Python 3\.9
+ lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 zip Python 3\.7
lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 win_x86_exe .+ Windows-(?:Vista|2008Server)
lockV2 yt-dlp/yt-dlp-nightly-builds 2024.10.22.051025 py2exe .+
lockV2 yt-dlp/yt-dlp-nightly-builds 2024.10.22.051025 zip Python 3\.8
lockV2 yt-dlp/yt-dlp-nightly-builds 2024.10.22.051025 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2)
lockV2 yt-dlp/yt-dlp-nightly-builds 2025.08.12.233030 darwin_legacy_exe .+
lockV2 yt-dlp/yt-dlp-nightly-builds 2025.08.30.232839 linux_armv7l_exe .+
- lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 (?!win_x86_exe).+ Python 3\.7
+ lockV2 yt-dlp/yt-dlp-nightly-builds 2025.10.14.232845 zip Python 3\.9
+ lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 zip Python 3\.7
lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 win_x86_exe .+ Windows-(?:Vista|2008Server)
lockV2 yt-dlp/yt-dlp-master-builds 2024.10.22.045052 py2exe .+
lockV2 yt-dlp/yt-dlp-master-builds 2024.10.22.060347 zip Python 3\.8
lockV2 yt-dlp/yt-dlp-master-builds 2024.10.22.060347 win(?:_x86)?_exe Python 3\.[78].+ Windows-(?:7-|2008ServerR2)
lockV2 yt-dlp/yt-dlp-master-builds 2025.08.12.232447 darwin_legacy_exe .+
lockV2 yt-dlp/yt-dlp-master-builds 2025.09.05.212910 linux_armv7l_exe .+
+ lockV2 yt-dlp/yt-dlp-master-builds 2025.10.14.232330 zip Python 3\.9
EOF
- name: Sign checksum files
diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml
index 93442529f5..d76495a25d 100644
--- a/.github/workflows/core.yml
+++ b/.github/workflows/core.yml
@@ -36,12 +36,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
- # CPython 3.9 is in quick-test
- python-version: ['3.10', '3.11', '3.12', '3.13', '3.14-dev', pypy-3.11]
+ # CPython 3.10 is in quick-test
+ python-version: ['3.11', '3.12', '3.13', '3.14', pypy-3.11]
include:
# atleast one of each CPython/PyPy tests must be in windows
- - os: windows-latest
- python-version: '3.9'
- os: windows-latest
python-version: '3.10'
- os: windows-latest
@@ -51,7 +49,7 @@ jobs:
- os: windows-latest
python-version: '3.13'
- os: windows-latest
- python-version: '3.14-dev'
+ python-version: '3.14'
- os: windows-latest
python-version: pypy-3.11
steps:
diff --git a/.github/workflows/download.yml b/.github/workflows/download.yml
index 8dbfee6f88..e5debc786d 100644
--- a/.github/workflows/download.yml
+++ b/.github/workflows/download.yml
@@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
- python-version: 3.9
+ python-version: '3.10'
- name: Install test requirements
run: python3 ./devscripts/install_deps.py --include dev
- name: Run tests
@@ -28,11 +28,11 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
- python-version: ['3.10', '3.11', '3.12', '3.13', '3.14-dev', pypy-3.11]
+ python-version: ['3.11', '3.12', '3.13', '3.14', pypy-3.11]
include:
# atleast one of each CPython/PyPy tests must be in windows
- os: windows-latest
- python-version: '3.9'
+ python-version: '3.10'
- os: windows-latest
python-version: pypy-3.11
steps:
diff --git a/.github/workflows/quick-test.yml b/.github/workflows/quick-test.yml
index 1c0fb4e4da..307559b96c 100644
--- a/.github/workflows/quick-test.yml
+++ b/.github/workflows/quick-test.yml
@@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Set up Python 3.9
+ - name: Set up Python 3.10
uses: actions/setup-python@v6
with:
- python-version: '3.9'
+ python-version: '3.10'
- name: Install test requirements
run: python3 ./devscripts/install_deps.py -o --include test
- name: Run tests
@@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
- python-version: '3.9'
+ python-version: '3.10'
- name: Install dev dependencies
run: python3 ./devscripts/install_deps.py -o --include static-analysis
- name: Make lazy extractors
diff --git a/.github/workflows/signature-tests.yml b/.github/workflows/signature-tests.yml
index ae2221d28a..8d48dff669 100644
--- a/.github/workflows/signature-tests.yml
+++ b/.github/workflows/signature-tests.yml
@@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
- python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14-dev', pypy-3.11]
+ python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', pypy-3.11]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 25cdf21e20..89327581c0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -284,7 +284,7 @@ After you have ensured this site is distributing its content legally, you can fo
You can use `hatch fmt` to automatically fix problems. Rules that the linter/formatter enforces should not be disabled with `# noqa` unless a maintainer requests it. The only exception allowed is for old/printf-style string formatting in GraphQL query templates (use `# noqa: UP031`).
-1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython >=3.9 and PyPy >=3.11. Backward compatibility is not required for even older versions of Python.
+1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython >=3.10 and PyPy >=3.11. Backward compatibility is not required for even older versions of Python.
1. When the tests pass, [add](https://git-scm.com/docs/git-add) the new files, [commit](https://git-scm.com/docs/git-commit) them and [push](https://git-scm.com/docs/git-push) the result, like this:
```shell
diff --git a/README.md b/README.md
index 60c312114b..6ee8d641ee 100644
--- a/README.md
+++ b/README.md
@@ -194,7 +194,7 @@ When running a yt-dlp version that is older than 90 days, you will see a warning
You can suppress this warning by adding `--no-update` to your command or configuration file.
## DEPENDENCIES
-Python versions 3.9+ (CPython) and 3.11+ (PyPy) are supported. Other versions and implementations may or may not work correctly.
+Python versions 3.10+ (CPython) and 3.11+ (PyPy) are supported. Other versions and implementations may or may not work correctly.
<!-- Python 3.5+ uses VC++14 and it is already embedded in the binary created
<!x-- https://www.microsoft.com/en-us/download/details.aspx?id=26999 --x>
@@ -273,7 +273,7 @@ On some systems, you may need to use `py` or `python` instead of `python3`.
**Important**: Running `pyinstaller` directly **instead of** using `python -m bundle.pyinstaller` is **not** officially supported. This may or may not work correctly.
### Platform-independent Binary (UNIX)
-You will need the build tools `python` (3.9+), `zip`, `make` (GNU), `pandoc`\* and `pytest`\*.
+You will need the build tools `python` (3.10+), `zip`, `make` (GNU), `pandoc`\* and `pytest`\*.
After installing these, simply run `make`.
@@ -2255,7 +2255,7 @@ Features marked with a **\*** have been back-ported to youtube-dl
Some of yt-dlp's default options are different from that of youtube-dl and youtube-dlc:
-* yt-dlp supports only [Python 3.9+](## "Windows 8"), and will remove support for more versions as they [become EOL](https://devguide.python.org/versions/#python-release-cycle); while [youtube-dl still supports Python 2.6+ and 3.2+](https://github.com/ytdl-org/youtube-dl/issues/30568#issue-1118238743)
+* yt-dlp supports only [Python 3.10+](## "Windows 8"), and will remove support for more versions as they [become EOL](https://devguide.python.org/versions/#python-release-cycle); while [youtube-dl still supports Python 2.6+ and 3.2+](https://github.com/ytdl-org/youtube-dl/issues/30568#issue-1118238743)
* The options `--auto-number` (`-A`), `--title` (`-t`) and `--literal` (`-l`), no longer work. See [removed options](#Removed) for details
* `avconv` is not supported as an alternative to `ffmpeg`
* yt-dlp stores config files in slightly different locations to youtube-dl. See [CONFIGURATION](#configuration) for a list of correct locations
diff --git a/devscripts/make_changelog.py b/devscripts/make_changelog.py
index 7c876101b4..0b2eb93b4e 100644
--- a/devscripts/make_changelog.py
+++ b/devscripts/make_changelog.py
@@ -373,7 +373,7 @@ class CommitRange:
issues = [issue.strip()[1:] for issue in issues.split(',')] if issues else []
if prefix:
- groups, details, sub_details = zip(*map(self.details_from_prefix, prefix.split(',')))
+ groups, details, sub_details = zip(*map(self.details_from_prefix, prefix.split(',')), strict=True)
group = next(iter(filter(None, groups)), None)
details = ', '.join(unique(details))
sub_details = list(itertools.chain.from_iterable(sub_details))
diff --git a/pyproject.toml b/pyproject.toml
index 3438140525..36a579fddb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -13,7 +13,7 @@ maintainers = [
]
description = "A feature-rich command-line audio/video downloader"
readme = "README.md"
-requires-python = ">=3.9"
+requires-python = ">=3.10"
keywords = [
"cli",
"downloader",
@@ -30,7 +30,6 @@ classifiers = [
"Environment :: Console",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
@@ -168,7 +167,6 @@ run-cov = "echo Code coverage not implemented && exit 1"
[[tool.hatch.envs.hatch-test.matrix]]
python = [
- "3.9",
"3.10",
"3.11",
"3.12",
diff --git a/test/helper.py b/test/helper.py
index e4cb478e28..e96835fc46 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -176,7 +176,7 @@ def _iter_differences(got, expected, field):
yield field, f'expected length of {len(expected)}, got {len(got)}'
return
- for index, (got_val, expected_val) in enumerate(zip(got, expected)):
+ for index, (got_val, expected_val) in enumerate(zip(got, expected, strict=True)):
field_name = str(index) if field is None else f'{field}.{index}'
yield from _iter_differences(got_val, expected_val, field_name)
return
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 91312e4e5f..72dfc20288 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -13,6 +13,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import contextlib
import copy
+import itertools
import json
from test.helper import FakeYDL, assertRegexpMatches, try_rm
@@ -414,7 +415,7 @@ class TestFormatSelection(unittest.TestCase):
downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts]
self.assertEqual(downloaded_ids, ['248+141'])
- for f1, f2 in zip(formats_order, formats_order[1:]):
+ for f1, f2 in itertools.pairwise(formats_order):
info_dict = _make_result([f1, f2], extractor='youtube')
ydl = YDL({'format': 'best/bestvideo'})
ydl.sort_formats(info_dict)
@@ -749,7 +750,7 @@ class TestYoutubeDL(unittest.TestCase):
if not isinstance(expected, (list, tuple)):
expected = (expected, expected)
- for (name, got), expect in zip((('outtmpl', out), ('filename', fname)), expected):
+ for (name, got), expect in zip((('outtmpl', out), ('filename', fname)), expected, strict=True):
if callable(expect):
self.assertTrue(expect(got), f'Wrong {name} from {tmpl}')
elif expect is not None:
@@ -1147,7 +1148,7 @@ class TestYoutubeDL(unittest.TestCase):
entries = func(evaluated)
results = [(v['playlist_autonumber'] - 1, (int(v['id']), v['playlist_index']))
for v in get_downloaded_info_dicts(params, entries)]
- self.assertEqual(results, list(enumerate(zip(expected_ids, expected_ids))), f'Entries of {name} for {params}')
+ self.assertEqual(results, list(enumerate(zip(expected_ids, expected_ids, strict=True))), f'Entries of {name} for {params}')
self.assertEqual(sorted(evaluated), expected_eval, f'Evaluation of {name} for {params}')
test_selection({}, INDICES)
diff --git a/test/test_postprocessors.py b/test/test_postprocessors.py
index ecc73e39eb..3911567066 100644
--- a/test/test_postprocessors.py
+++ b/test/test_postprocessors.py
@@ -115,7 +115,7 @@ class TestModifyChaptersPP(unittest.TestCase):
self.assertEqual(len(ends), len(titles))
start = 0
chapters = []
- for e, t in zip(ends, titles):
+ for e, t in zip(ends, titles, strict=True):
chapters.append(self._chapter(start, e, t))
start = e
return chapters
diff --git a/test/test_traversal.py b/test/test_traversal.py
index 52215f5a7b..d4abacc597 100644
--- a/test/test_traversal.py
+++ b/test/test_traversal.py
@@ -417,7 +417,7 @@ class TestTraversal:
def test_traversal_morsel(self):
morsel = http.cookies.Morsel()
- values = dict(zip(morsel, 'abcdefghijklmnop'))
+ values = dict(zip(morsel, 'abcdefghijklmnop', strict=False))
morsel.set('item_key', 'item_value', 'coded_value')
morsel.update(values)
values['key'] = 'item_key'
diff --git a/test/test_utils.py b/test/test_utils.py
index 83916b46d9..0865b39810 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1863,7 +1863,7 @@ Line 1
self.assertEqual(
list(get_elements_text_and_html_by_attribute('class', 'foo bar', html)),
- list(zip(['nice', 'also nice'], self.GET_ELEMENTS_BY_CLASS_RES)))
+ list(zip(['nice', 'also nice'], self.GET_ELEMENTS_BY_CLASS_RES, strict=True)))
self.assertEqual(list(get_elements_text_and_html_by_attribute('class', 'foo', html)), [])
self.assertEqual(list(get_elements_text_and_html_by_attribute('class', 'no-such-foo', html)), [])
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 3b41a15196..2e36319dd8 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -2007,7 +2007,7 @@ class YoutubeDL:
else:
entries = resolved_entries = list(entries)
n_entries = len(resolved_entries)
- ie_result['requested_entries'], ie_result['entries'] = tuple(zip(*resolved_entries)) or ([], [])
+ ie_result['requested_entries'], ie_result['entries'] = tuple(zip(*resolved_entries, strict=True)) or ([], [])
if not ie_result.get('playlist_count'):
# Better to do this after potentially exhausting entries
ie_result['playlist_count'] = all_entries.get_full_count()
@@ -2785,7 +2785,7 @@ class YoutubeDL:
dummy_chapter = {'end_time': 0, 'start_time': info_dict.get('duration')}
for idx, (prev, current, next_) in enumerate(zip(
- (dummy_chapter, *chapters), chapters, (*chapters[1:], dummy_chapter)), 1):
+ (dummy_chapter, *chapters), chapters, (*chapters[1:], dummy_chapter), strict=False), 1):
if current.get('start_time') is None:
current['start_time'] = prev.get('end_time')
if not current.get('end_time'):
@@ -3370,7 +3370,7 @@ class YoutubeDL:
def existing_video_file(*filepaths):
ext = info_dict.get('ext')
converted = lambda file: replace_extension(file, self.params.get('final_ext') or ext, ext)
- file = self.existing_file(itertools.chain(*zip(map(converted, filepaths), filepaths)),
+ file = self.existing_file(itertools.chain(*zip(map(converted, filepaths), filepaths, strict=True)),
default_overwrite=False)
if file:
info_dict['ext'] = os.path.splitext(file)[1][1:]
@@ -3956,7 +3956,7 @@ class YoutubeDL:
def render_subtitles_table(self, video_id, subtitles):
def _row(lang, formats):
- exts, names = zip(*((f['ext'], f.get('name') or 'unknown') for f in reversed(formats)))
+ exts, names = zip(*((f['ext'], f.get('name') or 'unknown') for f in reversed(formats)), strict=True)
if len(set(names)) == 1:
names = [] if names[0] == 'unknown' else names[:1]
return [lang, ', '.join(names), ', '.join(exts)]
@@ -4112,7 +4112,6 @@ class YoutubeDL:
self.params.get('cookiefile'), self.params.get('cookiesfrombrowser'), self)
except CookieLoadError as error:
cause = error.__context__
- # compat: <=py3.9: `traceback.format_exception` has a different signature
self.report_error(str(cause), tb=''.join(traceback.format_exception(None, cause, cause.__traceback__)))
raise
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index 224679e53b..8aee126030 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -1,8 +1,8 @@
import sys
-if sys.version_info < (3, 9):
+if sys.version_info < (3, 10):
raise ImportError(
- f'You are using an unsupported version of Python. Only Python versions 3.9 and above are supported by yt-dlp') # noqa: F541
+ f'You are using an unsupported version of Python. Only Python versions 3.10 and above are supported by yt-dlp') # noqa: F541
__license__ = 'The Unlicense'
@@ -974,13 +974,8 @@ def _real_main(argv=None):
try:
updater = Updater(ydl, opts.update_self)
- if opts.update_self and updater.update() and actual_use:
- if updater.cmd:
- return updater.restart()
- # This code is reachable only for zip variant in py < 3.10
- # It makes sense to exit here, but the old behavior is to continue
- ydl.report_warning('Restart yt-dlp to use the updated version')
- # return 100, 'ERROR: The program must exit for the update to complete'
+ if opts.update_self and updater.update() and actual_use and updater.cmd:
+ return updater.restart()
except Exception:
traceback.print_exc()
ydl._download_retcode = 100
diff --git a/yt_dlp/aes.py b/yt_dlp/aes.py
index 600cb12a89..e5a2e67cff 100644
--- a/yt_dlp/aes.py
+++ b/yt_dlp/aes.py
@@ -447,7 +447,7 @@ def key_schedule_core(data, rcon_iteration):
def xor(data1, data2):
- return [x ^ y for x, y in zip(data1, data2)]
+ return [x ^ y for x, y in zip(data1, data2, strict=False)]
def iter_mix_columns(data, matrix):
diff --git a/yt_dlp/compat/types.py b/yt_dlp/compat/types.py
deleted file mode 100644
index 4aa3b0efdd..0000000000
--- a/yt_dlp/compat/types.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# flake8: noqa: F405
-from types import * # noqa: F403
-
-from .compat_utils import passthrough_module
-
-passthrough_module(__name__, 'types')
-del passthrough_module
-
-try:
- # NB: pypy has builtin NoneType, so checking NameError won't work
- from types import NoneType # >= 3.10
-except ImportError:
- NoneType = type(None)
diff --git a/yt_dlp/compat/urllib/request.py b/yt_dlp/compat/urllib/request.py
index dfc7f4a2dc..ddb4e6f031 100644
--- a/yt_dlp/compat/urllib/request.py
+++ b/yt_dlp/compat/urllib/request.py
@@ -22,15 +22,11 @@ if os.name == 'nt':
def getproxies_registry_patched():
proxies = getproxies_registry()
- if (
- sys.version_info >= (3, 10, 5) # https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-5-final
- or (3, 9, 13) <= sys.version_info < (3, 10) # https://docs.python.org/3.9/whatsnew/changelog.html#python-3-9-13-final
- ):
- return proxies
-
- for scheme in ('https', 'ftp'):
- if scheme in proxies and proxies[scheme].startswith(f'{scheme}://'):
- proxies[scheme] = 'http' + proxies[scheme][len(scheme):]
+
+ if sys.version_info < (3, 10, 5): # https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-5-final
+ for scheme in ('https', 'ftp'):
+ if scheme in proxies and proxies[scheme].startswith(f'{scheme}://'):
+ proxies[scheme] = 'http' + proxies[scheme][len(scheme):]
return proxies
diff --git a/yt_dlp/extractor/archiveorg.py b/yt_dlp/extractor/archiveorg.py
index 1864ddbfd9..9a4e0b8c80 100644
--- a/yt_dlp/extractor/archiveorg.py
+++ b/yt_dlp/extractor/archiveorg.py
@@ -740,7 +740,7 @@ class YoutubeWebArchiveIE(InfoExtractor):
note or 'Downloading CDX API JSON', query=query, fatal=fatal)
if isinstance(res, list) and len(res) >= 2:
# format response to make it easier to use
- return [dict(zip(res[0], v)) for v in res[1:]]
+ return [dict(zip(res[0], v)) for v in res[1:]] # noqa: B905
elif not isinstance(res, list) or len(res) != 0:
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 573a9c5a0a..d6e2596ae1 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -1663,7 +1663,7 @@ class InfoExtractor:
'end_time': part.get('endOffset'),
} for part in variadic(e.get('hasPart') or []) if part.get('@type') == 'Clip']
for idx, (last_c, current_c, next_c) in enumerate(zip(
- [{'end_time': 0}, *chapters], chapters, chapters[1:])):
+ [{'end_time': 0}, *chapters], chapters, chapters[1:], strict=False)):
current_c['end_time'] = current_c['end_time'] or next_c['start_time']
current_c['start_time'] = current_c['start_time'] or last_c['end_time']
if None in current_c.values():
@@ -1848,7 +1848,7 @@ class InfoExtractor:
return {}
args = dict(zip(arg_keys.split(','), map(json.dumps, self._parse_json(
- f'[{arg_vals}]', video_id, transform_source=js_to_json, fatal=fatal) or ())))
+ f'[{arg_vals}]', video_id, transform_source=js_to_json, fatal=fatal) or ()), strict=True))
ret = self._parse_json(js, video_id, transform_source=functools.partial(js_to_json, vars=args), fatal=fatal)
return traverse_obj(ret, traverse) or {}
diff --git a/yt_dlp/extractor/dtube.py b/yt_dlp/extractor/dtube.py
index 0d87820c4c..2c47de8448 100644
--- a/yt_dlp/extractor/dtube.py
+++ b/yt_dlp/extractor/dtube.py
@@ -1,5 +1,4 @@
import json
-import socket
from .common import InfoExtractor
from ..utils import (
@@ -56,7 +55,7 @@ class DTubeIE(InfoExtractor):
try:
self.to_screen(f'{video_id}: Checking {format_id} video format URL')
self._downloader._opener.open(video_url, timeout=5).close()
- except socket.timeout:
+ except TimeoutError:
self.to_screen(
f'{video_id}: {format_id} URL is invalid, skipping')
continue
diff --git a/yt_dlp/extractor/fujitv.py b/yt_dlp/extractor/fujitv.py
index a2d1a828b4..3319b12681 100644
--- a/yt_dlp/extractor/fujitv.py
+++ b/yt_dlp/extractor/fujitv.py
@@ -56,7 +56,7 @@ class FujiTVFODPlus7IE(InfoExtractor):
fmt, subs = self._extract_m3u8_formats_and_subtitles(src['url'], video_id, 'ts')
for f in fmt:
f.update(dict(zip(('height', 'width'),
- self._BITRATE_MAP.get(f.get('tbr'), ()))))
+ self._BITRATE_MAP.get(f.get('tbr'), ()), strict=False)))
formats.extend(fmt)
subtitles = self._merge_subtitles(subtitles, subs)
diff --git a/yt_dlp/extractor/kaltura.py b/yt_dlp/extractor/kaltura.py
index dc11cbf6be..98516b8ce1 100644
--- a/yt_dlp/extractor/kaltura.py
+++ b/yt_dlp/extractor/kaltura.py
@@ -437,7 +437,7 @@ class KalturaIE(InfoExtractor):
params = urllib.parse.parse_qs(query)
if path:
splitted_path = path.split('/')
- params.update(dict(zip(splitted_path[::2], [[v] for v in splitted_path[1::2]])))
+ params.update(dict(zip(splitted_path[::2], [[v] for v in splitted_path[1::2]]))) # noqa: B905
if 'wid' in params:
partner_id = remove_start(params['wid'][0], '_')
elif 'p' in params:
diff --git a/yt_dlp/extractor/lynda.py b/yt_dlp/extractor/lynda.py
index bfd4619337..f7cf9261a8 100644
--- a/yt_dlp/extractor/lynda.py
+++ b/yt_dlp/extractor/lynda.py
@@ -1,3 +1,4 @@
+import itertools
import re
import urllib.parse
@@ -216,7 +217,7 @@ class LyndaIE(LyndaBaseIE):
def _fix_subtitles(self, subs):
srt = ''
seq_counter = 0
- for seq_current, seq_next in zip(subs, subs[1:]):
+ for seq_current, seq_next in itertools.pairwise(subs):
m_current = re.match(self._TIMECODE_REGEX, seq_current['Timecode'])
if m_current is None:
continue
diff --git a/yt_dlp/extractor/mojevideo.py b/yt_dlp/extractor/mojevideo.py
index 145e306970..1f95ed8bc0 100644
--- a/yt_dlp/extractor/mojevideo.py
+++ b/yt_dlp/extractor/mojevideo.py
@@ -92,7 +92,7 @@ class MojevideoIE(InfoExtractor):
contains_pattern=r'\[(?s:.+)\]', transform_source=js_to_json)
formats = []
- for video_hash, (suffix, quality, format_note) in zip(video_hashes, [
+ for video_hash, (suffix, quality, format_note) in zip(video_hashes, [ # noqa: B905
('', 1, 'normálna kvalita'),
('_lq', 0, 'nízka kvalita'),
('_hd', 2, 'HD-720p'),
diff --git a/yt_dlp/extractor/nhk.py b/yt_dlp/extractor/nhk.py
index 14fbd6ce82..eef3ed820c 100644
--- a/yt_dlp/extractor/nhk.py
+++ b/yt_dlp/extractor/nhk.py
@@ -503,7 +503,7 @@ class NhkForSchoolBangumiIE(InfoExtractor):
'start_time': s,
'end_time': e,
'title': t,
- } for s, e, t in zip(start_time, end_time, chapter_titles)]
+ } for s, e, t in zip(start_time, end_time, chapter_titles, strict=True)]
return {
'id': video_id,
diff --git a/yt_dlp/extractor/pbs.py b/yt_dlp/extractor/pbs.py
index 53b1994156..dde734ff3d 100644
--- a/yt_dlp/extractor/pbs.py
+++ b/yt_dlp/extractor/pbs.py
@@ -181,7 +181,7 @@ class PBSIE(InfoExtractor):
)
IE_NAME = 'pbs'
- IE_DESC = 'Public Broadcasting Service (PBS) and member stations: {}'.format(', '.join(list(zip(*_STATIONS))[1]))
+ IE_DESC = 'Public Broadcasting Service (PBS) and member stations: {}'.format(', '.join(list(zip(*_STATIONS, strict=True))[1]))
_VALID_URL = r'''(?x)https?://
(?:
@@ -193,7 +193,7 @@ class PBSIE(InfoExtractor):
(?:[^/?#]+/){{1,5}}(?P<presumptive_id>[^/?#]+?)(?:\.html)?/?(?:$|[?#])
)
)
- '''.format('|'.join(next(zip(*_STATIONS))))
+ '''.format('|'.join(next(zip(*_STATIONS, strict=True))))
_GEO_COUNTRIES = ['US']
diff --git a/yt_dlp/extractor/polskieradio.py b/yt_dlp/extractor/polskieradio.py
index 9d0496bdf0..8777f987e6 100644
--- a/yt_dlp/extractor/polskieradio.py
+++ b/yt_dlp/extractor/polskieradio.py
@@ -405,7 +405,7 @@ class PolskieRadioCategoryIE(InfoExtractor):
tab_content = self._download_json(
'https://www.polskieradio.pl/CMS/TemplateBoxesManagement/TemplateBoxTabContent.aspx/GetTabContent',
category_id, f'Downloading page {page_num}', headers={'content-type': 'application/json'},
- data=json.dumps(dict(zip((
+ data=json.dumps(dict(zip(( # noqa: B905
'boxInstanceId', 'tabId', 'categoryType', 'sectionId', 'categoryId', 'pagerMode',
'subjectIds', 'tagIndexId', 'queryString', 'name', 'openArticlesInParentTemplate',
'idSectionFromUrl', 'maxDocumentAge', 'showCategoryForArticle', 'pageNumber',
diff --git a/yt_dlp/extractor/pr0gramm.py b/yt_dlp/extractor/pr0gramm.py
index d5d6ecdfd8..0ba78a4f42 100644
--- a/yt_dlp/extractor/pr0gramm.py
+++ b/yt_dlp/extractor/pr0gramm.py
@@ -155,7 +155,7 @@ class Pr0grammIE(InfoExtractor):
# Sorted by "confidence", higher confidence = earlier in list
confidences = traverse_obj(metadata, ('tags', ..., 'confidence', ({int}, {float})))
if confidences:
- tags = [tag for _, tag in sorted(zip(confidences, tags), reverse=True)]
+ tags = [tag for _, tag in sorted(zip(confidences, tags), reverse=True)] # noqa: B905
formats = traverse_obj(video_info, ('variants', ..., {
'format_id': ('name', {str}),
diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py
index b6683a2027..b7e058ebe7 100644
--- a/yt_dlp/extractor/tiktok.py
+++ b/yt_dlp/extractor/tiktok.py
@@ -81,7 +81,7 @@ class TikTokBaseIE(InfoExtractor):
}
self._APP_INFO_POOL = [
{**defaults, **dict(
- (k, v) for k, v in zip(self._APP_INFO_DEFAULTS, app_info.split('/')) if v
+ (k, v) for k, v in zip(self._APP_INFO_DEFAULTS, app_info.split('/'), strict=False) if v
)} for app_info in self._KNOWN_APP_INFO
]
diff --git a/yt_dlp/jsinterp.py b/yt_dlp/jsinterp.py
index 460bc2c03e..d22d176d2f 100644
--- a/yt_dlp/jsinterp.py
+++ b/yt_dlp/jsinterp.py
@@ -186,7 +186,7 @@ _OPERATORS = { # None => Defined in JSInterpreter._operator
_COMP_OPERATORS = {'===', '!==', '==', '!=', '<=', '>=', '<', '>'}
_NAME_RE = r'[a-zA-Z_$][\w$]*'
-_MATCHING_PARENS = dict(zip(*zip('()', '{}', '[]')))
+_MATCHING_PARENS = dict(zip(*zip('()', '{}', '[]', strict=True), strict=True))
_QUOTES = '\'"/'
_NESTED_BRACKETS = r'[^[\]]+(?:\[[^[\]]+(?:\[[^\]]+\])?\])?'
diff --git a/yt_dlp/networking/_requests.py b/yt_dlp/networking/_requests.py
index 1526d2a599..06d3220f4a 100644
--- a/yt_dlp/networking/_requests.py
+++ b/yt_dlp/networking/_requests.py
@@ -4,7 +4,6 @@ import functools
import http.client
import logging
import re
-import socket
import warnings
from ..dependencies import brotli, requests, urllib3
@@ -125,7 +124,7 @@ class RequestsResponseAdapter(Response):
# Work around issue with `.read(amt)` then `.read()`
# See: https://github.com/urllib3/urllib3/issues/3636
if amt is None:
- # Python 3.9 preallocates the whole read buffer, read in chunks
+ # compat: py3.9: Python 3.9 preallocates the whole read buffer, read in chunks
read_chunk = functools.partial(self.fp.read, 1 << 20, decode_content=True)
return b''.join(iter(read_chunk, b''))
# Interact with urllib3 response directly.
@@ -378,7 +377,7 @@ class SocksHTTPConnection(urllib3.connection.HTTPConnection):
source_address=self.source_address,
_create_socket_func=functools.partial(
create_socks_proxy_socket, (self.host, self.port), self._proxy_args))
- except (socket.timeout, TimeoutError) as e:
+ except TimeoutError as e:
raise urllib3.exceptions.ConnectTimeoutError(
self, f'Connection to {self.host} timed out. (connect timeout={self.timeout})') from e
except SocksProxyError as e:
diff --git a/yt_dlp/networking/common.py b/yt_dlp/networking/common.py
index e33769422b..6680d1c7c8 100644
--- a/yt_dlp/networking/common.py
+++ b/yt_dlp/networking/common.py
@@ -12,6 +12,7 @@ import urllib.response
from collections.abc import Iterable, Mapping
from email.message import Message
from http import HTTPStatus
+from types import NoneType
from ._helper import make_ssl_context, wrap_request_errors
from .exceptions import (
@@ -20,7 +21,6 @@ from .exceptions import (
TransportError,
UnsupportedRequest,
)
-from ..compat.types import NoneType
from ..cookies import YoutubeDLCookieJar
from ..utils import (
bug_reports_message,
diff --git a/yt_dlp/networking/impersonate.py b/yt_dlp/networking/impersonate.py
index b90d10b760..458ec04a19 100644
--- a/yt_dlp/networking/impersonate.py
+++ b/yt_dlp/networking/impersonate.py
@@ -3,11 +3,11 @@ from __future__ import annotations
import re
from abc import ABC
from dataclasses import dataclass
+from types import NoneType
from typing import Any
from .common import RequestHandler, register_preference, Request
from .exceptions import UnsupportedRequest
-from ..compat.types import NoneType
from ..utils import classproperty, join_nonempty
from ..utils.networking import std_headers, HTTPHeaderDict
diff --git a/yt_dlp/plugins.py b/yt_dlp/plugins.py
index 941709b21d..f9c1ceaa6b 100644
--- a/yt_dlp/plugins.py
+++ b/yt_dlp/plugins.py
@@ -11,7 +11,6 @@ import os
import pkgutil
import sys
import traceback
-import zipimport
from pathlib import Path
from zipfile import ZipFile
@@ -202,16 +201,10 @@ def load_plugins(plugin_spec: PluginSpec):
if any(x.startswith('_') for x in module_name.split('.')):
continue
try:
- if sys.version_info < (3, 10) and isinstance(finder, zipimport.zipimporter):
- # zipimporter.load_module() is deprecated in 3.10 and removed in 3.12
- # The exec_module branch below is the replacement for >= 3.10
- # See: https://docs.python.org/3/library/zipimport.html#zipimport.zipimporter.exec_module
- module = finder.load_module(module_name)
- else:
- spec = finder.find_spec(module_name)
- module = importlib.util.module_from_spec(spec)
- sys.modules[module_name] = module
- spec.loader.exec_module(module)
+ spec = finder.find_spec(module_name)
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[module_name] = module
+ spec.loader.exec_module(module)
except Exception:
write_string(
f'Error while importing module {module_name!r}\n{traceback.format_exc(limit=-1)}',
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index 774625660a..5c9c0390d9 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -418,7 +418,7 @@ class FFmpegPostProcessor(PostProcessor):
if concat_opts is None:
concat_opts = [{}] * len(in_files)
yield 'ffconcat version 1.0\n'
- for file, opts in zip(in_files, concat_opts):
+ for file, opts in zip(in_files, concat_opts, strict=True):
yield f'file {cls._quote_for_ffmpeg(cls._ffmpeg_filename_argument(file))}\n'
# Iterate explicitly to yield the following directives in order, ignoring the rest.
for directive in 'inpoint', 'outpoint', 'duration':
@@ -639,7 +639,7 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
# postprocessor a second time
'-map', '-0:s',
]
- for i, (lang, name) in enumerate(zip(sub_langs, sub_names)):
+ for i, (lang, name) in enumerate(zip(sub_langs, sub_names, strict=True)):
opts.extend(['-map', f'{i + 1}:0'])
lang_code = ISO639Utils.short2long(lang) or lang
opts.extend([f'-metadata:s:s:{i}', f'language={lang_code}'])
diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index e33be3f7b3..42b56248df 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -154,7 +154,7 @@ def _get_binary_name():
def _get_system_deprecation():
- MIN_SUPPORTED, MIN_RECOMMENDED = (3, 9), (3, 10)
+ MIN_SUPPORTED, MIN_RECOMMENDED = (3, 10), (3, 10)
if sys.version_info > MIN_RECOMMENDED:
return None
@@ -559,11 +559,9 @@ class Updater:
@functools.cached_property
def cmd(self):
"""The command-line to run the executable, if known"""
- argv = None
- # There is no sys.orig_argv in py < 3.10. Also, it can be [] when frozen
- if getattr(sys, 'orig_argv', None):
- argv = sys.orig_argv
- elif getattr(sys, 'frozen', False):
+ argv = sys.orig_argv
+ # sys.orig_argv can be [] when frozen
+ if not argv and getattr(sys, 'frozen', False):
argv = sys.argv
# linux_static exe's argv[0] will be /tmp/staticx-NNNN/yt-dlp_linux if we don't fixup here
if argv and os.getenv('STATICX_PROG_PATH'):
@@ -572,7 +570,7 @@ class Updater:
def restart(self):
"""Restart the executable"""
- assert self.cmd, 'Must be frozen or Py >= 3.10'
+ assert self.cmd, 'Unable to determine argv'
self.ydl.write_debug(f'Restarting: {shell_quote(self.cmd)}')
_, _, returncode = Popen.run(self.cmd)
return returncode
diff --git a/yt_dlp/utils/_legacy.py b/yt_dlp/utils/_legacy.py
index d65b135d9d..baa8162370 100644
--- a/yt_dlp/utils/_legacy.py
+++ b/yt_dlp/utils/_legacy.py
@@ -1,6 +1,4 @@
"""No longer used and new code should not use. Exists only for API compat."""
-import asyncio
-import atexit
import platform
import struct
import sys
@@ -34,77 +32,6 @@ has_certifi = bool(certifi)
has_websockets = bool(websockets)
-class WebSocketsWrapper:
- """Wraps websockets module to use in non-async scopes"""
- pool = None
-
- def __init__(self, url, headers=None, connect=True, **ws_kwargs):
- self.loop = asyncio.new_event_loop()
- # XXX: "loop" is deprecated
- self.conn = websockets.connect(
- url, extra_headers=headers, ping_interval=None,
- close_timeout=float('inf'), loop=self.loop, ping_timeout=float('inf'), **ws_kwargs)
- if connect:
- self.__enter__()
- atexit.register(self.__exit__, None, None, None)
-
- def __enter__(self):
- if not self.pool:
- self.pool = self.run_with_loop(self.conn.__aenter__(), self.loop)
- return self
-
- def send(self, *args):
- self.run_with_loop(self.pool.send(*args), self.loop)
-
- def recv(self, *args):
- return self.run_with_loop(self.pool.recv(*args), self.loop)
-
- def __exit__(self, type, value, traceback):
- try:
- return self.run_with_loop(self.conn.__aexit__(type, value, traceback), self.loop)
- finally:
- self.loop.close()
- self._cancel_all_tasks(self.loop)
-
- # taken from https://github.com/python/cpython/blob/3.9/Lib/asyncio/runners.py with modifications
- # for contributors: If there's any new library using asyncio needs to be run in non-async, move these function out of this class
- @staticmethod
- def run_with_loop(main, loop):
- if not asyncio.iscoroutine(main):
- raise ValueError(f'a coroutine was expected, got {main!r}')
-
- try:
- return loop.run_until_complete(main)
- finally:
- loop.run_until_complete(loop.shutdown_asyncgens())
- if hasattr(loop, 'shutdown_default_executor'):
- loop.run_until_complete(loop.shutdown_default_executor())
-
- @staticmethod
- def _cancel_all_tasks(loop):
- to_cancel = asyncio.all_tasks(loop)
-
- if not to_cancel:
- return
-
- for task in to_cancel:
- task.cancel()
-
- # XXX: "loop" is removed in Python 3.10+
- loop.run_until_complete(
- asyncio.gather(*to_cancel, loop=loop, return_exceptions=True))
-
- for task in to_cancel:
- if task.cancelled():
- continue
- if task.exception() is not None:
- loop.call_exception_handler({
- 'message': 'unhandled exception during asyncio.run() shutdown',
- 'exception': task.exception(),
- 'task': task,
- })
-
-
def load_plugins(name, suffix, namespace):
from ..plugins import load_plugins
ret = load_plugins(name, suffix)
diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py
index 50652c1e45..e5268deff9 100644
--- a/yt_dlp/utils/_utils.py
+++ b/yt_dlp/utils/_utils.py
@@ -95,7 +95,7 @@ TIMEZONE_NAMES = {
# needed for sanitizing filenames in restricted mode
ACCENT_CHARS = dict(zip('ÂÃÄÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖŐØŒÙÚÛÜŰÝÞßàáâãäåæçèéêëìíîïðñòóôõöőøœùúûüűýþÿ',
itertools.chain('AAAAAA', ['AE'], 'CEEEEIIIIDNOOOOOOO', ['OE'], 'UUUUUY', ['TH', 'ss'],
- 'aaaaaa', ['ae'], 'ceeeeiiiionooooooo', ['oe'], 'uuuuuy', ['th'], 'y')))
+ 'aaaaaa', ['ae'], 'ceeeeiiiionooooooo', ['oe'], 'uuuuuy', ['th'], 'y'), strict=True))
DATE_FORMATS = (
'%d %B %Y',
@@ -2402,7 +2402,6 @@ class PlaylistEntries:
def __init__(self, ydl, info_dict):
self.ydl = ydl
-
# _entries must be assigned now since infodict can change during iteration
entries = info_dict.get('entries')
if entries is None:
@@ -2415,7 +2414,7 @@ class PlaylistEntries:
if self.is_incomplete:
assert self.is_exhausted
self._entries = [self.MissingEntry] * max(requested_entries or [0])
- for i, entry in zip(requested_entries, entries):
+ for i, entry in zip(requested_entries, entries): # noqa: B905
self._entries[i - 1] = entry
elif isinstance(entries, (list, PagedList, LazyList)):
self._entries = entries
@@ -3184,7 +3183,7 @@ def render_table(header_row, data, delim=False, extra_gap=0, hide_empty=False):
return len(remove_terminal_sequences(string).replace('\t', ''))
def get_max_lens(table):
- return [max(width(str(v)) for v in col) for col in zip(*table)]
+ return [max(width(str(v)) for v in col) for col in zip(*table, strict=True)]
def filter_using_list(row, filter_array):
return [col for take, col in itertools.zip_longest(filter_array, row, fillvalue=True) if take]
@@ -3540,7 +3539,7 @@ def dfxp2srt(dfxp_data):
continue
default_style.update(style)
- for para, index in zip(paras, itertools.count(1)):
+ for para, index in zip(paras, itertools.count(1), strict=False):
begin_time = parse_dfxp_time_expr(para.attrib.get('begin'))
end_time = parse_dfxp_time_expr(para.attrib.get('end'))
dur = parse_dfxp_time_expr(para.attrib.get('dur'))
@@ -4854,7 +4853,7 @@ def scale_thumbnails_to_max_format_width(formats, thumbnails, url_width_re):
return [
merge_dicts(
{'url': re.sub(url_width_re, str(max_dimensions[0]), thumbnail['url'])},
- dict(zip(_keys, max_dimensions)), thumbnail)
+ dict(zip(_keys, max_dimensions, strict=True)), thumbnail)
for thumbnail in thumbnails
]
diff --git a/yt_dlp/utils/jslib/devalue.py b/yt_dlp/utils/jslib/devalue.py
index d82880d921..ac5bd68577 100644
--- a/yt_dlp/utils/jslib/devalue.py
+++ b/yt_dlp/utils/jslib/devalue.py
@@ -110,7 +110,7 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
elif value[0] == 'Map':
result = []
- for key, new_source in zip(*(iter(value[1:]),) * 2):
+ for key, new_source in zip(*(iter(value[1:]),) * 2, strict=True):
pair = [None, None]
stack.append((pair, 0, key))
stack.append((pair, 1, new_source))
@@ -129,7 +129,7 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
elif value[0] == 'null':
result = {}
- for key, new_source in zip(*(iter(value[1:]),) * 2):
+ for key, new_source in zip(*(iter(value[1:]),) * 2, strict=True):
stack.append((result, key, new_source))
elif value[0] in _ARRAY_TYPE_LOOKUP:
diff --git a/yt_dlp/webvtt.py b/yt_dlp/webvtt.py
index 9f1a5086b8..a86ddc7ce0 100644
--- a/yt_dlp/webvtt.py
+++ b/yt_dlp/webvtt.py
@@ -103,7 +103,7 @@ def _parse_ts(ts):
into an MPEG PES timestamp: a tick counter at 90 kHz resolution.
"""
return 90 * sum(
- int(part or 0) * mult for part, mult in zip(ts.groups(), (3600_000, 60_000, 1000, 1)))
+ int(part or 0) * mult for part, mult in zip(ts.groups(), (3600_000, 60_000, 1000, 1), strict=True))
def _format_ts(ts):