[cleanup] Sort imports

Using https://github.com/PyCQA/isort

    isort -m VERTICAL_HANGING_INDENT --py 36 -l 80 --rr -n --tc .
pull/3404/head
pukkandan 4 months ago
parent 86e5f3ed2e
commit f82711587c
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
  1. 1
      .gitignore
  2. 2
      devscripts/bash-completion.py
  3. 5
      devscripts/check-porn.py
  4. 2
      devscripts/fish-completion.py
  5. 6
      devscripts/generate_aes_testdata.py
  6. 4
      devscripts/make_lazy_extractors.py
  7. 2
      devscripts/make_readme.py
  8. 1
      devscripts/make_supportedsites.py
  9. 1
      devscripts/update-formulae.py
  10. 5
      devscripts/update-version.py
  11. 2
      devscripts/zsh-completion.py
  12. 12
      pyinst.py
  13. 6
      setup.py
  14. 13
      test/helper.py
  15. 14
      test/test_InfoExtractor.py
  16. 17
      test/test_YoutubeDL.py
  17. 1
      test/test_YoutubeDLCookieJar.py
  18. 16
      test/test_aes.py
  19. 3
      test/test_age_restriction.py
  20. 9
      test/test_all_urls.py
  21. 5
      test/test_cache.py
  22. 5
      test/test_compat.py
  23. 4
      test/test_cookies.py
  24. 15
      test/test_download.py
  25. 4
      test/test_downloader_http.py
  26. 6
      test/test_execution.py
  27. 6
      test/test_http.py
  28. 2
      test/test_iqiyi_sdk_interpreter.py
  29. 1
      test/test_jsinterp.py
  30. 1
      test/test_netrc.py
  31. 4
      test/test_overwrites.py
  32. 4
      test/test_post_hooks.py
  33. 2
      test/test_postprocessors.py
  34. 12
      test/test_socks.py
  35. 28
      test/test_subtitles.py
  36. 2
      test/test_update.py.disabled
  37. 95
      test/test_utils.py
  38. 6
      test/test_verbose_output.py
  39. 8
      test/test_write_annotations.py.disabled
  40. 6
      test/test_youtube_lists.py
  41. 1
      test/test_youtube_misc.py
  42. 5
      test/test_youtube_signature.py
  43. 124
      yt_dlp/YoutubeDL.py
  44. 42
      yt_dlp/__init__.py
  45. 12
      yt_dlp/aes.py
  46. 5
      yt_dlp/cache.py
  47. 12
      yt_dlp/cookies.py
  48. 14
      yt_dlp/downloader/__init__.py
  49. 18
      yt_dlp/downloader/common.py
  50. 3
      yt_dlp/downloader/dash.py
  51. 17
      yt_dlp/downloader/external.py
  52. 11
      yt_dlp/downloader/f4m.py
  53. 8
      yt_dlp/downloader/fragment.py
  54. 20
      yt_dlp/downloader/hls.py
  55. 13
      yt_dlp/downloader/http.py
  56. 7
      yt_dlp/downloader/ism.py
  57. 7
      yt_dlp/downloader/mhtml.py
  58. 4
      yt_dlp/downloader/rtmp.py
  59. 5
      yt_dlp/downloader/rtsp.py
  60. 2
      yt_dlp/downloader/websocket.py
  61. 7
      yt_dlp/downloader/youtube_live_chat.py
  62. 28
      yt_dlp/extractor/abematv.py
  63. 23
      yt_dlp/extractor/common.py
  64. 4
      yt_dlp/extractor/commonprotocols.py
  65. 215
      yt_dlp/extractor/generic.py
  66. 4
      yt_dlp/extractor/mtv.py
  67. 4
      yt_dlp/extractor/noz.py
  68. 8
      yt_dlp/extractor/openload.py
  69. 7
      yt_dlp/extractor/youtube.py
  70. 7
      yt_dlp/jsinterp.py
  71. 2
      yt_dlp/minicurses.py
  72. 29
      yt_dlp/options.py
  73. 15
      yt_dlp/postprocessor/__init__.py
  74. 2
      yt_dlp/postprocessor/common.py
  75. 13
      yt_dlp/postprocessor/embedthumbnail.py
  76. 6
      yt_dlp/postprocessor/exec.py
  77. 16
      yt_dlp/postprocessor/ffmpeg.py
  78. 12
      yt_dlp/postprocessor/modify_chapters.py
  79. 2
      yt_dlp/postprocessor/movefilesafterdownload.py
  80. 6
      yt_dlp/postprocessor/sponskrub.py
  81. 2
      yt_dlp/postprocessor/sponsorblock.py
  82. 4
      yt_dlp/postprocessor/xattrpp.py
  83. 6
      yt_dlp/socks.py
  84. 3
      yt_dlp/update.py
  85. 22
      yt_dlp/utils.py
  86. 8
      yt_dlp/webvtt.py

1
.gitignore vendored

@ -82,6 +82,7 @@ updates_key.pem
*.egg-info
.tox
*.class
*.isorted
# Generated
AUTHORS

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import os
from os.path import dirname as dirn
import sys
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
import yt_dlp

@ -10,11 +10,12 @@ pass the list filename as the only argument
# Allow direct execution
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import gettestcases
from yt_dlp.utils import compat_urllib_parse_urlparse
from yt_dlp.utils import compat_urllib_request
from yt_dlp.utils import compat_urllib_parse_urlparse, compat_urllib_request
if len(sys.argv) > 1:
METHOD = 'LIST'

@ -1,8 +1,8 @@
#!/usr/bin/env python3
import optparse
import os
from os.path import dirname as dirn
import sys
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
import yt_dlp

@ -1,13 +1,13 @@
#!/usr/bin/env python3
import codecs
import subprocess
import os
import subprocess
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from yt_dlp.utils import intlist_to_bytes
from yt_dlp.aes import aes_encrypt, key_expansion
from yt_dlp.utils import intlist_to_bytes
secret_msg = b'Secret message goes here'

@ -1,8 +1,8 @@
#!/usr/bin/env python3
from inspect import getsource
import os
from os.path import dirname as dirn
import sys
from inspect import getsource
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))

@ -2,8 +2,8 @@
# yt-dlp --help | make_readme.py
# This must be run in a console of correct width
import sys
import re
import sys
README_FILE = 'README.md'
helptext = sys.stdin.read()

@ -3,7 +3,6 @@ import optparse
import os
import sys
# Import yt_dlp
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, ROOT_DIR)

@ -8,7 +8,6 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from yt_dlp.compat import compat_urllib_request
# usage: python3 ./devscripts/update-formulae.py <path-to-formulae-rb> <version>
# version can be either 0-aligned (yt-dlp version) or normalized (PyPl version)

@ -1,8 +1,7 @@
#!/usr/bin/env python3
from datetime import datetime
import sys
import subprocess
import sys
from datetime import datetime
with open('yt_dlp/version.py') as f:
exec(compile(f.read(), 'yt_dlp/version.py', 'exec'))

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import os
from os.path import dirname as dirn
import sys
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
import yt_dlp

@ -2,14 +2,20 @@
import os
import platform
import sys
from PyInstaller.utils.hooks import collect_submodules
from PyInstaller.utils.hooks import collect_submodules
OS_NAME = platform.system()
if OS_NAME == 'Windows':
from PyInstaller.utils.win32.versioninfo import (
VarStruct, VarFileInfo, StringStruct, StringTable,
StringFileInfo, FixedFileInfo, VSVersionInfo, SetVersion,
FixedFileInfo,
SetVersion,
StringFileInfo,
StringStruct,
StringTable,
VarFileInfo,
VarStruct,
VSVersionInfo,
)
elif OS_NAME == 'Darwin':
pass

@ -1,13 +1,13 @@
#!/usr/bin/env python3
import os.path
import warnings
import sys
import warnings
try:
from setuptools import setup, Command, find_packages
from setuptools import Command, find_packages, setup
setuptools_available = True
except ImportError:
from distutils.core import setup, Command
from distutils.core import Command, setup
setuptools_available = False
from distutils.spawn import spawn

@ -3,21 +3,14 @@ import hashlib
import json
import os.path
import re
import types
import ssl
import sys
import types
import yt_dlp.extractor
from yt_dlp import YoutubeDL
from yt_dlp.compat import (
compat_os_name,
compat_str,
)
from yt_dlp.utils import (
preferredencoding,
write_string,
)
from yt_dlp.compat import compat_os_name, compat_str
from yt_dlp.utils import preferredencoding, write_string
if 'pytest' in sys.modules:
import pytest

@ -3,15 +3,21 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import threading
from test.helper import FakeYDL, expect_dict, expect_value, http_server_port
from yt_dlp.compat import compat_etree_fromstring, compat_http_server
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.extractor import YoutubeIE, get_info_extractor
from yt_dlp.utils import encode_data_uri, strip_jsonp, ExtractorError, RegexNotFoundError
import threading
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.utils import (
ExtractorError,
RegexNotFoundError,
encode_data_uri,
strip_jsonp,
)
TEAPOT_RESPONSE_STATUS = 418
TEAPOT_RESPONSE_BODY = "<h1>418 I'm a teapot</h1>"

@ -3,18 +3,29 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import copy
import json
from test.helper import FakeYDL, assertRegexpMatches
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_os_name, compat_setenv, compat_str, compat_urllib_error
from yt_dlp.compat import (
compat_os_name,
compat_setenv,
compat_str,
compat_urllib_error,
)
from yt_dlp.extractor import YoutubeIE
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.postprocessor.common import PostProcessor
from yt_dlp.utils import ExtractorError, int_or_none, match_filter_func, LazyList
from yt_dlp.utils import (
ExtractorError,
LazyList,
int_or_none,
match_filter_func,
)
TEST_URL = 'http://localhost/sample.mp4'

@ -4,6 +4,7 @@ import re
import sys
import tempfile
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from yt_dlp.utils import YoutubeDLCookieJar

@ -3,26 +3,28 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import base64
from yt_dlp.aes import (
aes_decrypt,
aes_encrypt,
aes_ecb_encrypt,
aes_ecb_decrypt,
BLOCK_SIZE_BYTES,
aes_cbc_decrypt,
aes_cbc_decrypt_bytes,
aes_cbc_encrypt,
aes_ctr_decrypt,
aes_ctr_encrypt,
aes_decrypt,
aes_decrypt_text,
aes_ecb_decrypt,
aes_ecb_encrypt,
aes_encrypt,
aes_gcm_decrypt_and_verify,
aes_gcm_decrypt_and_verify_bytes,
aes_decrypt_text,
BLOCK_SIZE_BYTES,
)
from yt_dlp.compat import compat_pycrypto_AES
from yt_dlp.utils import bytes_to_intlist, intlist_to_bytes
import base64
# the encrypted data can be generate with 'devscripts/generate_aes_testdata.py'

@ -3,9 +3,10 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import try_rm, is_download_test
from test.helper import is_download_test, try_rm
from yt_dlp import YoutubeDL

@ -1,19 +1,16 @@
#!/usr/bin/env python3
# Allow direct execution
import collections
import os
import sys
import unittest
import collections
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import gettestcases
from yt_dlp.extractor import (
FacebookIE,
gen_extractors,
YoutubeIE,
)
from yt_dlp.extractor import FacebookIE, YoutubeIE, gen_extractors
class TestAllURLsMatching(unittest.TestCase):

@ -1,14 +1,15 @@
#!/usr/bin/env python3
import shutil
# Allow direct execution
import os
import shutil
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL
from yt_dlp.cache import Cache

@ -3,14 +3,15 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from yt_dlp.compat import (
compat_getenv,
compat_setenv,
compat_etree_fromstring,
compat_expanduser,
compat_getenv,
compat_setenv,
compat_str,
compat_struct_unpack,
compat_urllib_parse_unquote,

@ -6,10 +6,10 @@ from yt_dlp.cookies import (
LinuxChromeCookieDecryptor,
MacChromeCookieDecryptor,
WindowsChromeCookieDecryptor,
parse_safari_cookies,
pbkdf2_sha1,
_get_linux_desktop_environment,
_LinuxDesktopEnvironment,
parse_safari_cookies,
pbkdf2_sha1,
)

@ -1,8 +1,12 @@
#!/usr/bin/env python3
# Allow direct execution
import hashlib
import json
import os
import socket
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import (
@ -16,24 +20,19 @@ from test.helper import (
try_rm,
)
import hashlib
import json
import socket
import yt_dlp.YoutubeDL
from yt_dlp.compat import (
compat_http_client,
compat_urllib_error,
compat_HTTPError,
compat_urllib_error,
)
from yt_dlp.extractor import get_info_extractor
from yt_dlp.utils import (
DownloadError,
ExtractorError,
format_bytes,
UnavailableVideoError,
format_bytes,
)
from yt_dlp.extractor import get_info_extractor
RETRIES = 3

@ -4,14 +4,16 @@ import os
import re
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import threading
from test.helper import http_server_port, try_rm
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_http_server
from yt_dlp.downloader.http import HttpFD
from yt_dlp.utils import encodeFilename
import threading
TEST_DIR = os.path.dirname(os.path.abspath(__file__))

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import unittest
import sys
import os
import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from yt_dlp.utils import encodeArgument

@ -3,13 +3,15 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import ssl
import threading
from test.helper import http_server_port
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_http_server, compat_urllib_request
import ssl
import threading
TEST_DIR = os.path.dirname(os.path.abspath(__file__))

@ -3,9 +3,11 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import IqiyiIE

@ -3,6 +3,7 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from yt_dlp.jsinterp import JSInterpreter

@ -1,6 +1,7 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

@ -1,14 +1,14 @@
#!/usr/bin/env python3
import os
from os.path import join
import subprocess
import sys
import unittest
from os.path import join
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import is_download_test, try_rm
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
download_file = join(root_dir, 'test.webm')

@ -2,9 +2,11 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import get_params, try_rm, is_download_test
from test.helper import get_params, is_download_test, try_rm
import yt_dlp.YoutubeDL
from yt_dlp.utils import DownloadError

@ -13,7 +13,7 @@ from yt_dlp.postprocessor import (
FFmpegThumbnailsConvertorPP,
MetadataFromFieldPP,
MetadataParserPP,
ModifyChaptersPP
ModifyChaptersPP,
)

@ -3,20 +3,14 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import random
import subprocess
from test.helper import FakeYDL, get_params, is_download_test
from test.helper import (
FakeYDL,
get_params,
is_download_test,
)
from yt_dlp.compat import (
compat_str,
compat_urllib_request,
)
from yt_dlp.compat import compat_str, compat_urllib_request
@is_download_test

@ -3,29 +3,29 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, md5, is_download_test
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, is_download_test, md5
from yt_dlp.extractor import (
YoutubeIE,
DailymotionIE,
TedTalkIE,
VimeoIE,
WallaIE,
CeskaTelevizeIE,
LyndaIE,
NPOIE,
NRKTVIE,
PBSIE,
CeskaTelevizeIE,
ComedyCentralIE,
NRKTVIE,
DailymotionIE,
DemocracynowIE,
LyndaIE,
RaiPlayIE,
VikiIE,
ThePlatformIE,
ThePlatformFeedIE,
RTVEALaCartaIE,
DemocracynowIE,
TedTalkIE,
ThePlatformFeedIE,
ThePlatformIE,
VikiIE,
VimeoIE,
WallaIE,
YoutubeIE,
)

@ -3,10 +3,12 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import json
from yt_dlp.update import rsa_verify

@ -3,6 +3,7 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -12,75 +13,95 @@ import itertools
import json
import xml.etree.ElementTree
from yt_dlp.compat import (
compat_chr,
compat_etree_fromstring,
compat_getenv,
compat_HTMLParseError,
compat_os_name,
compat_setenv,
)
from yt_dlp.utils import (
Config,
DateRange,
ExtractorError,
InAdvancePagedList,
LazyList,
OnDemandPagedList,
age_restricted,
args_to_str,
encode_base_n,
base_url,
caesar,
clean_html,
clean_podcast_url,
Config,
cli_bool_option,
cli_option,
cli_valueless_option,
date_from_str,
datetime_from_str,
DateRange,
detect_exe_version,
determine_ext,
dfxp2srt,
dict_get,
encode_base_n,
encode_compat_str,
encodeFilename,
escape_rfc3986,
escape_url,
expand_path,
extract_attributes,
ExtractorError,
find_xpath_attr,
fix_xml_ampersands,
format_bytes,
float_or_none,
get_element_by_class,
format_bytes,
get_element_by_attribute,
get_elements_by_class,
get_elements_by_attribute,
get_element_html_by_class,
get_element_by_class,
get_element_html_by_attribute,
get_elements_html_by_class,
get_element_html_by_class,
get_element_text_and_html_by_tag,
get_elements_by_attribute,
get_elements_by_class,
get_elements_html_by_attribute,
get_elements_html_by_class,
get_elements_text_and_html_by_attribute,
get_element_text_and_html_by_tag,
InAdvancePagedList,
int_or_none,
intlist_to_bytes,
iri_to_uri,
is_html,
js_to_json,
limit_length,
locked_file,
lowercase_escape,
match_str,
merge_dicts,
mimetype2ext,
month_by_name,
multipart_encode,
ohdave_rsa_encrypt,
OnDemandPagedList,
orderedSet,
parse_age_limit,
parse_bitrate,
parse_codecs,
parse_count,
parse_dfxp_time_expr,
parse_duration,
parse_filesize,
parse_count,
parse_iso8601,
parse_resolution,
parse_bitrate,
parse_qs,
parse_resolution,
pkcs1pad,
prepend_extension,
read_batch_urls,
remove_end,
remove_quotes,
remove_start,
render_table,
replace_extension,
rot47,
sanitize_filename,
sanitize_path,
sanitize_url,
sanitized_Request,
expand_path,
prepend_extension,
replace_extension,
remove_start,
remove_end,
remove_quotes,
rot47,
shell_quote,
smuggle_url,
str_to_int,
@ -92,38 +113,18 @@ from yt_dlp.utils import (
unified_strdate,
unified_timestamp,
unsmuggle_url,
update_url_query,
uppercase_escape,
lowercase_escape,
url_basename,
url_or_none,
base_url,
urljoin,
urlencode_postdata,
urljoin,
urshift,
update_url_query,
version_tuple,
xpath_with_ns,
xpath_attr,
xpath_element,
xpath_text,
xpath_attr,
render_table,
match_str,
parse_dfxp_time_expr,
dfxp2srt,
cli_option,
cli_valueless_option,
cli_bool_option,
parse_codecs,
iri_to_uri,
LazyList,
)
from yt_dlp.compat import (
compat_chr,
compat_etree_fromstring,
compat_getenv,
compat_HTMLParseError,
compat_os_name,
compat_setenv,
xpath_with_ns,
)

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import unittest
import sys
import os
import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

@ -3,17 +3,15 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import get_params, try_rm, is_download_test
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import io
import xml.etree.ElementTree
from test.helper import get_params, is_download_test, try_rm
import yt_dlp.YoutubeDL
import yt_dlp.extractor
import yt_dlp.YoutubeDL
class YoutubeDL(yt_dlp.YoutubeDL):

@ -3,14 +3,12 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import (
YoutubeIE,
YoutubeTabIE,
)
from yt_dlp.extractor import YoutubeIE, YoutubeTabIE
@is_download_test

@ -3,6 +3,7 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

@ -3,16 +3,17 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import re
import string
import urllib.request
from test.helper import FakeYDL, is_download_test
from yt_dlp.compat import compat_str
from yt_dlp.extractor import YoutubeIE
from yt_dlp.jsinterp import JSInterpreter
from yt_dlp.compat import compat_str
_SIG_TESTS = [
(

@ -12,6 +12,7 @@ import locale
import operator
import os
import platform
import random
import re
import shutil
import subprocess
@ -20,13 +21,12 @@ import tempfile
import time
import tokenize
import traceback
import random
import unicodedata
import urllib.request
from enum import Enum
from string import ascii_letters
from .cache import Cache
from .compat import (
compat_brotli,
compat_get_terminal_size,
@ -39,74 +39,100 @@ from .compat import (
windows_enable_vt_mode,
)
from .cookies import load_cookies
from .downloader import FFmpegFD, get_suitable_downloader, shorten_protocol_name
from .downloader.rtmp import rtmpdump_version
from .extractor import _LAZY_LOADER
from .extractor import _PLUGIN_CLASSES as plugin_extractors
from .extractor import gen_extractor_classes, get_info_extractor
from .extractor.openload import PhantomJSwrapper
from .minicurses import format_text
from .postprocessor import _PLUGIN_CLASSES as plugin_postprocessors
from .postprocessor import (
EmbedThumbnailPP,
FFmpegFixupDuplicateMoovPP,
FFmpegFixupDurationPP,
FFmpegFixupM3u8PP,
FFmpegFixupM4aPP,
FFmpegFixupStretchedPP,
FFmpegFixupTimestampPP,
FFmpegMergerPP,
FFmpegPostProcessor,
MoveFilesAfterDownloadPP,
get_postprocessor,
)
from .update import detect_variant
from .utils import (
DEFAULT_OUTTMPL,
LINK_TEMPLATES,
NO_DEFAULT,
OUTTMPL_TYPES,
POSTPROCESS_WHEN,
STR_FORMAT_RE_TMPL,
STR_FORMAT_TYPES,
ContentTooShortError,
DateRange,
DownloadCancelled,
DownloadError,
EntryNotInPlaylist,
ExistingVideoReached,
ExtractorError,
GeoRestrictedError,
HEADRequest,
InAdvancePagedList,
ISO3166Utils,
LazyList,
MaxDownloadsReached,
PagedList,
PerRequestProxyHandler,
Popen,
PostProcessingError,
ReExtractInfo,
RejectedVideoReached,
SameFileError,
UnavailableVideoError,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
YoutubeDLRedirectHandler,
age_restricted,
args_to_str,
ContentTooShortError,
date_from_str,
DateRange,
DEFAULT_OUTTMPL,
determine_ext,
determine_protocol,
DownloadCancelled,
DownloadError,
encode_compat_str,
encodeFilename,
EntryNotInPlaylist,
error_to_compat_str,
ExistingVideoReached,
expand_path,
ExtractorError,
filter_dict,
float_or_none,
format_bytes,
format_field,
format_decimal_suffix,
format_field,
formatSeconds,
GeoRestrictedError,
get_domain,
has_certifi,
HEADRequest,
InAdvancePagedList,
int_or_none,
iri_to_uri,
ISO3166Utils,
join_nonempty,
LazyList,
LINK_TEMPLATES,
locked_file,
make_dir,
make_HTTPS_handler,
MaxDownloadsReached,
merge_headers,
network_exceptions,
NO_DEFAULT,
number_of_digits,
orderedSet,
OUTTMPL_TYPES,
PagedList,
parse_filesize,
PerRequestProxyHandler,
platform_name,
Popen,
POSTPROCESS_WHEN,
PostProcessingError,
preferredencoding,
prepend_extension,
ReExtractInfo,
register_socks_protocols,
RejectedVideoReached,
remove_terminal_sequences,
render_table,
replace_extension,
SameFileError,
sanitize_filename,
sanitize_path,
sanitize_url,
sanitized_Request,
std_headers,
STR_FORMAT_RE_TMPL,
STR_FORMAT_TYPES,
str_or_none,
strftime_or_none,
subtitles_filename,
@ -115,47 +141,13 @@ from .utils import (
to_high_limit_path,
traverse_obj,
try_get,
UnavailableVideoError,
url_basename,
variadic,
version_tuple,
write_json_file,
write_string,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
YoutubeDLRedirectHandler,
)
from .cache import Cache
from .minicurses import format_text
from .extractor import (
gen_extractor_classes,
get_info_extractor,
_LAZY_LOADER,
_PLUGIN_CLASSES as plugin_extractors
)
from .extractor.openload import PhantomJSwrapper
from .downloader import (
FFmpegFD,
get_suitable_downloader,
shorten_protocol_name
)
from .downloader.rtmp import rtmpdump_version
from .postprocessor import (
get_postprocessor,
EmbedThumbnailPP,
FFmpegFixupDuplicateMoovPP,
FFmpegFixupDurationPP,
FFmpegFixupM3u8PP,
FFmpegFixupM4aPP,
FFmpegFixupStretchedPP,
FFmpegFixupTimestampPP,
FFmpegMergerPP,
FFmpegPostProcessor,
MoveFilesAfterDownloadPP,
_PLUGIN_CLASSES as plugin_postprocessors
)
from .update import detect_variant
from .version import __version__, RELEASE_GIT_HEAD
from .version import RELEASE_GIT_HEAD, __version__
if compat_os_name == 'nt':
import ctypes
@ -3666,9 +3658,9 @@ class YoutubeDL:
) or 'none'
write_debug('exe versions: %s' % exe_str)
from .cookies import SECRETSTORAGE_AVAILABLE, SQLITE_AVAILABLE
from .downloader.websocket import has_websockets
from .postprocessor.embedthumbnail import has_mutagen
from .cookies import SQLITE_AVAILABLE, SECRETSTORAGE_AVAILABLE
lib_str = join_nonempty(
compat_brotli and compat_brotli.__name__,

@ -9,48 +9,44 @@ import random
import re
import sys
from .compat import compat_getpass, compat_os_name, compat_shlex_quote
from .cookies import SUPPORTED_BROWSERS, SUPPORTED_KEYRINGS
from .downloader import FileDownloader
from .extractor import gen_extractors, list_extractors
from .extractor.adobepass import MSO_INFO
from .extractor.common import InfoExtractor
from .options import parseOpts
from .compat import (
compat_getpass,
compat_os_name,
compat_shlex_quote,
from .postprocessor import (
FFmpegExtractAudioPP,
FFmpegSubtitlesConvertorPP,
FFmpegThumbnailsConvertorPP,
FFmpegVideoConvertorPP,
FFmpegVideoRemuxerPP,
MetadataFromFieldPP,
MetadataParserPP,
)
from .cookies import SUPPORTED_BROWSERS, SUPPORTED_KEYRINGS
from .update import run_update
from .utils import (
NO_DEFAULT,
DateRange,
decodeOption,
DownloadCancelled,
DownloadError,
GeoUtils,
SameFileError,
decodeOption,
expand_path,
float_or_none,
GeoUtils,
int_or_none,
match_filter_func,
NO_DEFAULT,
parse_duration,
preferredencoding,
read_batch_urls,
render_table,
SameFileError,
setproctitle,
std_headers,
traverse_obj,
write_string,
)
from .update import run_update
from .downloader import FileDownloader
from .extractor import gen_extractors, list_extractors
from .extractor.common import InfoExtractor
from .extractor.adobepass import MSO_INFO
from .postprocessor import (
FFmpegExtractAudioPP,
FFmpegSubtitlesConvertorPP,
FFmpegThumbnailsConvertorPP,
FFmpegVideoConvertorPP,
FFmpegVideoRemuxerPP,
MetadataFromFieldPP,
MetadataParserPP,
)
from .YoutubeDL import YoutubeDL

@ -1,15 +1,7 @@
from math import ceil
from .compat import (
compat_b64decode,
compat_ord,
compat_pycrypto_AES,
)
from .utils import (
bytes_to_intlist,
intlist_to_bytes,
)
from .compat import compat_b64decode, compat_ord, compat_pycrypto_AES
from .utils import bytes_to_intlist, intlist_to_bytes
if compat_pycrypto_AES:
def aes_cbc_decrypt_bytes(data, key, iv):

@ -6,10 +6,7 @@ import shutil
import traceback
from .compat import compat_getenv
from .utils import (
expand_path,
write_json_file,
)
from .utils import expand_path, write_json_file
class Cache:

@ -16,17 +16,9 @@ from .aes import (
aes_gcm_decrypt_and_verify_bytes,
unpad_pkcs7,
)
from .compat import (
compat_b64decode,