A feature-rich command-line audio/video downloader
[cleanup] Consistent style for file heads
pukkandan54007a45f11e
diff --git a/devscripts/bash-completion.py b/devscripts/bash-completion.pyindex 268e8a2aee..9b4a9d4e2f 100755--- a/devscripts/bash-completion.py+++ b/devscripts/bash-completion.py@@ -1,9 +1,12 @@#!/usr/bin/env python3++# Allow direct executionimport osimport syssys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import yt_dlpBASH_COMPLETION_FILE = "completions/bash/yt-dlp"diff --git a/devscripts/fish-completion.py b/devscripts/fish-completion.pyindex d9c0048e23..5d2f68a489 100755--- a/devscripts/fish-completion.py+++ b/devscripts/fish-completion.py@@ -1,10 +1,14 @@#!/usr/bin/env python3-import optparse++# Allow direct executionimport osimport syssys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import optparse+import yt_dlpfrom yt_dlp.utils import shell_quotediff --git a/devscripts/generate_aes_testdata.py b/devscripts/generate_aes_testdata.pyindex c7d83f1a75..7f3c88bcfb 100644--- a/devscripts/generate_aes_testdata.py+++ b/devscripts/generate_aes_testdata.py@@ -1,11 +1,15 @@#!/usr/bin/env python3-import codecs++# Allow direct executionimport os-import subprocessimport syssys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import codecs+import subprocess+from yt_dlp.aes import aes_encrypt, key_expansionfrom yt_dlp.utils import intlist_to_bytesdiff --git a/devscripts/make_contributing.py b/devscripts/make_contributing.pyindex 2562c4fd75..a06f8a616e 100755--- a/devscripts/make_contributing.py+++ b/devscripts/make_contributing.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+import optparseimport rediff --git a/devscripts/make_issue_template.py b/devscripts/make_issue_template.pyindex 5a309008e2..54043ef4ee 100644--- a/devscripts/make_issue_template.py+++ b/devscripts/make_issue_template.py@@ -1,4 +1,12 @@#!/usr/bin/env python3++# Allow direct execution+import os+import sys++sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import optparse@@ -7,7 +15,7 @@ def read(fname):return f.read()-# Get the version from yt_dlp/version.py without importing the package+# Get the version without importing the packagedef read_version(fname):exec(compile(read(fname), fname, 'exec'))return locals()['__version__']diff --git a/devscripts/make_lazy_extractors.py b/devscripts/make_lazy_extractors.pyindex 39d4646d01..785d66a6a1 100644--- a/devscripts/make_lazy_extractors.py+++ b/devscripts/make_lazy_extractors.py@@ -1,12 +1,15 @@#!/usr/bin/env python3-import optparse++# Allow direct executionimport osimport sys-from inspect import getsourcesys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import optparse+from inspect import getsource+NO_ATTR = object()STATIC_CLASS_PROPERTIES = ['IE_NAME', 'IE_DESC', 'SEARCH_KEY', '_WORKING', '_NETRC_MACHINE', 'age_limit']CLASS_METHODS = [diff --git a/devscripts/make_readme.py b/devscripts/make_readme.pyindex 015212aa36..f2e08d7c6e 100755--- a/devscripts/make_readme.py+++ b/devscripts/make_readme.py@@ -1,7 +1,11 @@#!/usr/bin/env python3-# yt-dlp --help | make_readme.py-# This must be run in a console of correct width+"""+yt-dlp --help | make_readme.py+This must be run in a console of correct width+"""++import functoolsimport reimport sysdiff --git a/devscripts/make_supportedsites.py b/devscripts/make_supportedsites.pyindex d8c53c5e13..e46f7af565 100644--- a/devscripts/make_supportedsites.py+++ b/devscripts/make_supportedsites.py@@ -1,10 +1,14 @@#!/usr/bin/env python3-import optparse++# Allow direct executionimport osimport syssys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import optparse+from yt_dlp.extractor import list_extractor_classesdiff --git a/devscripts/prepare_manpage.py b/devscripts/prepare_manpage.pyindex 91e9ebcedc..cea9349499 100644--- a/devscripts/prepare_manpage.py+++ b/devscripts/prepare_manpage.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+import optparseimport os.pathimport re@@ -23,7 +24,7 @@ yt\-dlp \- A youtube-dl fork with additional features and patchesdef main():parser = optparse.OptionParser(usage='%prog OUTFILE.md')- options, args = parser.parse_args()+ _, args = parser.parse_args()if len(args) != 1:parser.error('Expected an output filename')diff --git a/devscripts/update-version.py b/devscripts/update-version.pyindex 991cfb2aff..c5bc83de93 100644--- a/devscripts/update-version.py+++ b/devscripts/update-version.py@@ -1,4 +1,12 @@#!/usr/bin/env python3++# Allow direct execution+import os+import sys++sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import subprocessimport sysfrom datetime import datetimediff --git a/devscripts/zsh-completion.py b/devscripts/zsh-completion.pyindex 59faea06a2..267af5f6ec 100755--- a/devscripts/zsh-completion.py+++ b/devscripts/zsh-completion.py@@ -1,9 +1,12 @@#!/usr/bin/env python3++# Allow direct executionimport osimport syssys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import yt_dlpZSH_COMPLETION_FILE = "completions/zsh/_yt-dlp"diff --git a/pyinst.py b/pyinst.pyindex 4401125ed5..a7c1be85d9 100644--- a/pyinst.py+++ b/pyinst.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+import osimport platformimport sysdiff --git a/setup.cfg b/setup.cfgindex 946d7b1223..415cca91a8 100644--- a/setup.cfg+++ b/setup.cfg@@ -37,3 +37,5 @@ line_length = 80reverse_relative = trueensure_newline_before_comments = trueinclude_trailing_comma = true+known_first_party =+ testdiff --git a/setup.py b/setup.pyindex 6dae442aa4..9803e928c4 100644--- a/setup.py+++ b/setup.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+import os.pathimport sysimport warningsdiff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.pyindex f0571c41a9..f57a29ffc7 100644--- a/test/test_InfoExtractor.py+++ b/test/test_InfoExtractor.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysdiff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.pyindex 1153881e94..44e8f2917b 100644--- a/test/test_YoutubeDL.py+++ b/test/test_YoutubeDL.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,6 +7,7 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import copyimport jsonimport urllib.errordiff --git a/test/test_YoutubeDLCookieJar.py b/test/test_YoutubeDLCookieJar.pyindex 6280e1f2cb..0d4e7dc97c 100644--- a/test/test_YoutubeDLCookieJar.py+++ b/test/test_YoutubeDLCookieJar.py@@ -1,12 +1,16 @@#!/usr/bin/env python3++# Allow direct executionimport os-import reimport sys-import tempfileimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import re+import tempfile+from yt_dlp.utils import YoutubeDLCookieJardiff --git a/test/test_aes.py b/test/test_aes.pyindex 2b7b7cf542..0372465885 100644--- a/test/test_aes.py+++ b/test/test_aes.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,6 +7,7 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import base64from yt_dlp.aes import (diff --git a/test/test_age_restriction.py b/test/test_age_restriction.pyindex e1012f69bb..ff248432b9 100644--- a/test/test_age_restriction.py+++ b/test/test_age_restriction.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,8 +7,8 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-from test.helper import is_download_test, try_rm+from test.helper import is_download_test, try_rmfrom yt_dlp import YoutubeDLdiff --git a/test/test_all_urls.py b/test/test_all_urls.pyindex b6019554e5..848c96ff02 100644--- a/test/test_all_urls.py+++ b/test/test_all_urls.py@@ -1,6 +1,6 @@#!/usr/bin/env python3+# Allow direct execution-import collectionsimport osimport sysimport unittest@@ -8,8 +8,9 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-from test.helper import gettestcases+import collections+from test.helper import gettestcasesfrom yt_dlp.extractor import FacebookIE, YoutubeIE, gen_extractorsdiff --git a/test/test_cache.py b/test/test_cache.pyindex 14e54ba204..ce1624b68b 100644--- a/test/test_cache.py+++ b/test/test_cache.py@@ -1,15 +1,16 @@#!/usr/bin/env python3+# Allow direct executionimport os-import shutilimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-from test.helper import FakeYDL+import shutil+from test.helper import FakeYDLfrom yt_dlp.cache import Cachediff --git a/test/test_compat.py b/test/test_compat.pyindex 62bf5a3062..a70adfa302 100644--- a/test/test_compat.py+++ b/test/test_compat.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysdiff --git a/test/test_download.py b/test/test_download.pyindex b82f174bb0..b98ddebcbe 100755--- a/test/test_download.py+++ b/test/test_download.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -8,10 +9,10 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))import hashlib+import http.clientimport jsonimport socketimport urllib.error-import http.clientfrom test.helper import (assertGreaterEqual,@@ -23,6 +24,7 @@ from test.helper import (report_warning,try_rm,)+import yt_dlp.YoutubeDL # isort: splitfrom yt_dlp.compat import compat_HTTPErrorfrom yt_dlp.extractor import get_info_extractordiff --git a/test/test_downloader_http.py b/test/test_downloader_http.pyindex dac7707588..cce7c59e22 100644--- a/test/test_downloader_http.py+++ b/test/test_downloader_http.py@@ -1,17 +1,18 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysimport unittest-import http.serversys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import http.serverimport reimport threading-from test.helper import http_server_port, try_rm+from test.helper import http_server_port, try_rmfrom yt_dlp import YoutubeDLfrom yt_dlp.downloader.http import HttpFDfrom yt_dlp.utils import encodeFilenamediff --git a/test/test_execution.py b/test/test_execution.pyindex 6efd432e97..1d15fddabc 100644--- a/test/test_execution.py+++ b/test/test_execution.py@@ -1,12 +1,16 @@#!/usr/bin/env python3-import contextlib++# Allow direct executionimport os-import subprocessimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import contextlib+import subprocess+from yt_dlp.utils import encodeArgumentrootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))diff --git a/test/test_http.py b/test/test_http.pyindex 828797ec71..b1aac77206 100644--- a/test/test_http.py+++ b/test/test_http.py@@ -1,18 +1,19 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysimport unittest-import http.serversys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import http.serverimport sslimport threadingimport urllib.request-from test.helper import http_server_port+from test.helper import http_server_portfrom yt_dlp import YoutubeDLTEST_DIR = os.path.dirname(os.path.abspath(__file__))diff --git a/test/test_iqiyi_sdk_interpreter.py b/test/test_iqiyi_sdk_interpreter.pyindex 4b82b71874..47c632a4e2 100644--- a/test/test_iqiyi_sdk_interpreter.py+++ b/test/test_iqiyi_sdk_interpreter.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,8 +7,8 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-from test.helper import FakeYDL, is_download_test+from test.helper import FakeYDL, is_download_testfrom yt_dlp.extractor import IqiyiIEdiff --git a/test/test_jsinterp.py b/test/test_jsinterp.pyindex 872c58c8fa..4277cabe02 100644--- a/test/test_jsinterp.py+++ b/test/test_jsinterp.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,6 +7,7 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+from yt_dlp.jsinterp import JSInterpreterdiff --git a/test/test_netrc.py b/test/test_netrc.pyindex f7a0b33d26..dc708d974c 100644--- a/test/test_netrc.py+++ b/test/test_netrc.py@@ -1,3 +1,6 @@+#!/usr/bin/env python3++# Allow direct executionimport osimport sysimport unittestdiff --git a/test/test_overwrites.py b/test/test_overwrites.pyindex a6d5bae40d..6954c07f90 100644--- a/test/test_overwrites.py+++ b/test/test_overwrites.py@@ -1,11 +1,15 @@#!/usr/bin/env python3++# Allow direct executionimport os-import subprocessimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import subprocess+from test.helper import is_download_test, try_rmroot_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))diff --git a/test/test_post_hooks.py b/test/test_post_hooks.pyindex e84a08f295..3778d17942 100644--- a/test/test_post_hooks.py+++ b/test/test_post_hooks.py@@ -1,13 +1,15 @@#!/usr/bin/env python3++# Allow direct executionimport osimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-from test.helper import get_params, is_download_test, try_rm-import yt_dlp.YoutubeDL+from test.helper import get_params, is_download_test, try_rm+import yt_dlp.YoutubeDL # isort: splitfrom yt_dlp.utils import DownloadErrordiff --git a/test/test_postprocessors.py b/test/test_postprocessors.pyindex 9d8a4dcc50..c49e3ede0f 100644--- a/test/test_postprocessors.py+++ b/test/test_postprocessors.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,6 +7,7 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+from yt_dlp import YoutubeDLfrom yt_dlp.compat import compat_shlex_quotefrom yt_dlp.postprocessor import (diff --git a/test/test_socks.py b/test/test_socks.pyindex 0b8e03a9f7..159faf58ed 100644--- a/test/test_socks.py+++ b/test/test_socks.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,6 +7,7 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import randomimport subprocessimport urllib.requestdiff --git a/test/test_subtitles.py b/test/test_subtitles.pyindex 5120f83e2d..57362895f1 100644--- a/test/test_subtitles.py+++ b/test/test_subtitles.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysdiff --git a/test/test_update.py.disabled b/test/test_update.py.disabledindex 73b55cdace..85ac866923 100644--- a/test/test_update.py.disabled+++ b/test/test_update.py.disabled@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysdiff --git a/test/test_utils.py b/test/test_utils.pyindex 38647adb44..8024a8e7c8 100644--- a/test/test_utils.py+++ b/test/test_utils.py@@ -1,6 +1,6 @@#!/usr/bin/env python3+# Allow direct execution-import contextlibimport osimport sysimport unittest@@ -8,7 +8,7 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-# Various small unit tests+import contextlibimport ioimport itertoolsimport jsondiff --git a/test/test_verbose_output.py b/test/test_verbose_output.pyindex 6579940740..21ce10a1fb 100644--- a/test/test_verbose_output.py+++ b/test/test_verbose_output.py@@ -1,11 +1,15 @@#!/usr/bin/env python3++# Allow direct executionimport os-import subprocessimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import subprocess+rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))diff --git a/test/test_write_annotations.py.disabled b/test/test_write_annotations.py.disabledindex cca60561f5..c7cf199f6c 100644--- a/test/test_write_annotations.py.disabled+++ b/test/test_write_annotations.py.disabled@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,11 +7,12 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+import xml.etree.ElementTree-from test.helper import get_params, is_download_test, try_rmimport yt_dlp.extractorimport yt_dlp.YoutubeDL+from test.helper import get_params, is_download_test, try_rmclass YoutubeDL(yt_dlp.YoutubeDL):diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.pyindex 66611e236e..c2dd0ac308 100644--- a/test/test_youtube_lists.py+++ b/test/test_youtube_lists.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sys@@ -6,8 +7,8 @@ import unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))-from test.helper import FakeYDL, is_download_test+from test.helper import FakeYDL, is_download_testfrom yt_dlp.extractor import YoutubeIE, YoutubeTabIEdiff --git a/test/test_youtube_misc.py b/test/test_youtube_misc.pyindex 36f8be6890..81be5d3c9e 100644--- a/test/test_youtube_misc.py+++ b/test/test_youtube_misc.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Allow direct executionimport osimport sysdiff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.pyindex 2c2013295c..56304772b4 100644--- a/test/test_youtube_signature.py+++ b/test/test_youtube_signature.py@@ -1,17 +1,19 @@#!/usr/bin/env python3+# Allow direct execution-import contextlibimport osimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++import contextlibimport reimport stringimport urllib.request-from test.helper import FakeYDL, is_download_test+from test.helper import FakeYDL, is_download_testfrom yt_dlp.compat import compat_strfrom yt_dlp.extractor import YoutubeIEfrom yt_dlp.jsinterp import JSInterpreterdiff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex df4eef4e2b..94aaaeb604 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -1,4 +1,3 @@-#!/usr/bin/env python3import collectionsimport contextlibimport datetimediff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.pyindex a5921c5656..357be861b4 100644--- a/yt_dlp/__init__.py+++ b/yt_dlp/__init__.py@@ -1,4 +1,3 @@-#!/usr/bin/env python3f'You are using an unsupported version of Python. Only Python versions 3.6 and above are supported by yt-dlp' # noqa: F541__license__ = 'Public Domain'diff --git a/yt_dlp/__main__.py b/yt_dlp/__main__.pyindex c9d275b863..ff5d71d3c9 100644--- a/yt_dlp/__main__.py+++ b/yt_dlp/__main__.py@@ -1,4 +1,5 @@#!/usr/bin/env python3+# Execute with# $ python -m yt_dlpdiff --git a/yt_dlp/compat/__init__.py b/yt_dlp/compat/__init__.pyindex 3a91fad0e0..9f8e8c3e53 100644--- a/yt_dlp/compat/__init__.py+++ b/yt_dlp/compat/__init__.py@@ -7,7 +7,6 @@ from . import refrom ._deprecated import * # noqa: F401, F403from .compat_utils import passthrough_module-# XXX: Implement this the same way as other DeprecationWarnings without circular importtry:passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(diff --git a/yt_dlp/compat/_legacy.py b/yt_dlp/compat/_legacy.pyindex 2b33638b66..49bb13a3c9 100644--- a/yt_dlp/compat/_legacy.py+++ b/yt_dlp/compat/_legacy.py@@ -22,7 +22,7 @@ import urllib.requestimport xml.etree.ElementTree as etreefrom subprocess import DEVNULL-from .compat_utils import passthrough_module+from .compat_utils import passthrough_module # isort: splitfrom .asyncio import run as compat_asyncio_run # noqa: F401from .re import Pattern as compat_Pattern # noqa: F401from .re import match as compat_Match # noqa: F401@@ -30,7 +30,6 @@ from ..dependencies import Cryptodome_AES as compat_pycrypto_AES # noqa: F401from ..dependencies import brotli as compat_brotli # noqa: F401from ..dependencies import websockets as compat_websockets # noqa: F401-passthrough_module(__name__, '...utils', ('WINDOWS_VT_MODE', 'windows_enable_vt_mode'))diff --git a/yt_dlp/compat/compat_utils.py b/yt_dlp/compat/compat_utils.pyindex 79e253056b..82e1762810 100644--- a/yt_dlp/compat/compat_utils.py+++ b/yt_dlp/compat/compat_utils.py@@ -4,7 +4,6 @@ import importlibimport sysimport types-_NO_ATTRIBUTE = object()_Package = collections.namedtuple('Package', ('name', 'version'))diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.pyindex 6811a72881..e2ff8c39f8 100644--- a/yt_dlp/cookies.py+++ b/yt_dlp/cookies.py@@ -1,5 +1,6 @@import contextlibimport ctypes+import http.cookiejarimport jsonimport osimport shutil@@ -11,7 +12,6 @@ import timefrom datetime import datetime, timedelta, timezonefrom enum import Enum, autofrom hashlib import pbkdf2_hmac-import http.cookiejarfrom .aes import (aes_cbc_decrypt_bytes,diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.pyindex ca5b264985..6b59320b8a 100644--- a/yt_dlp/downloader/http.py+++ b/yt_dlp/downloader/http.py@@ -1,10 +1,10 @@+import http.clientimport osimport randomimport socketimport sslimport timeimport urllib.error-import http.clientfrom .common import FileDownloaderfrom ..utils import (diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.pyindex 1c3d4af2c0..4c37044f67 100644--- a/yt_dlp/extractor/common.py+++ b/yt_dlp/extractor/common.py@@ -2,6 +2,9 @@ import base64import collectionsimport getpassimport hashlib+import http.client+import http.cookiejar+import http.cookiesimport itertoolsimport jsonimport math@@ -12,9 +15,6 @@ import sysimport timeimport urllib.requestimport xml.etree.ElementTree-import http.client-import http.cookiejar-import http.cookiesfrom ..compat import functools, re # isort: splitfrom ..compat import (diff --git a/yt_dlp/extractor/iwara.py b/yt_dlp/extractor/iwara.pyindex 32ebd2ba61..f77c5d44d2 100644--- a/yt_dlp/extractor/iwara.py+++ b/yt_dlp/extractor/iwara.py@@ -7,10 +7,10 @@ from ..utils import (int_or_none,mimetype2ext,remove_end,+ strip_or_none,+ unified_strdate,url_or_none,urljoin,- unified_strdate,- strip_or_none,)diff --git a/yt_dlp/extractor/nebula.py b/yt_dlp/extractor/nebula.pyindex 9478f3aa30..7057b8b26e 100644--- a/yt_dlp/extractor/nebula.py+++ b/yt_dlp/extractor/nebula.py@@ -1,8 +1,8 @@import itertoolsimport jsonimport time-import urllib.parseimport urllib.error+import urllib.parsefrom .common import InfoExtractorfrom ..utils import ExtractorError, parse_iso8601, try_getdiff --git a/yt_dlp/extractor/shared.py b/yt_dlp/extractor/shared.pyindex 31c0080ba4..9a237b3204 100644--- a/yt_dlp/extractor/shared.py+++ b/yt_dlp/extractor/shared.py@@ -1,5 +1,3 @@--import urllib.parsefrom .common import InfoExtractordiff --git a/yt_dlp/extractor/urort.py b/yt_dlp/extractor/urort.pyindex be508f4349..3f687f737b 100644--- a/yt_dlp/extractor/urort.py+++ b/yt_dlp/extractor/urort.py@@ -1,5 +1,3 @@--import urllib.parsefrom .common import InfoExtractordiff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex 6b02eb450e..7327f31500 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -1,4 +1,3 @@-#!/usr/bin/env python3import atexitimport base64import binascii@@ -16,6 +15,8 @@ import hashlibimport hmacimport html.entitiesimport html.parser+import http.client+import http.cookiejarimport importlib.utilimport ioimport itertools@@ -42,8 +43,6 @@ import urllib.parseimport urllib.requestimport xml.etree.ElementTreeimport zlib-import http.client-import http.cookiejarfrom .compat import asyncio, functools # isort: splitfrom .compat import (