#!/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 yt_dlp
BASH_COMPLETION_FILE = "completions/bash/yt-dlp"
#!/usr/bin/env python3
-import optparse
+
+# Allow direct execution
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import optparse
+
import yt_dlp
from yt_dlp.utils import shell_quote
#!/usr/bin/env python3
-import codecs
+
+# Allow direct execution
import os
-import subprocess
import sys
sys.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_expansion
from yt_dlp.utils import intlist_to_bytes
#!/usr/bin/env python3
+
import optparse
import re
#!/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
return f.read()
-# Get the version from yt_dlp/version.py without importing the package
+# Get the version without importing the package
def read_version(fname):
exec(compile(read(fname), fname, 'exec'))
return locals()['__version__']
#!/usr/bin/env python3
-import optparse
+
+# Allow direct execution
import os
import sys
-from inspect import getsource
sys.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 = [
#!/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 functools
import re
import sys
#!/usr/bin/env python3
-import optparse
+
+# Allow direct execution
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import optparse
+
from yt_dlp.extractor import list_extractor_classes
#!/usr/bin/env python3
+
import optparse
import os.path
import re
def 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')
#!/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 subprocess
import sys
from datetime import datetime
#!/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 yt_dlp
ZSH_COMPLETION_FILE = "completions/zsh/_yt-dlp"
#!/usr/bin/env python3
+
import os
import platform
import sys
reverse_relative = true
ensure_newline_before_comments = true
include_trailing_comma = true
+known_first_party =
+ test
#!/usr/bin/env python3
+
import os.path
import sys
import warnings
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
#!/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 copy
import json
import urllib.error
#!/usr/bin/env python3
+
+# Allow direct execution
import os
-import re
import sys
-import tempfile
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import re
+import tempfile
+
from yt_dlp.utils import YoutubeDLCookieJar
#!/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 base64
from yt_dlp.aes import (
#!/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__))))
-from test.helper import is_download_test, try_rm
+from test.helper import is_download_test, try_rm
from yt_dlp import YoutubeDL
#!/usr/bin/env python3
+
# Allow direct execution
-import collections
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import gettestcases
+import collections
+from test.helper import gettestcases
from yt_dlp.extractor import FacebookIE, YoutubeIE, gen_extractors
#!/usr/bin/env python3
+
# 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
+import shutil
+from test.helper import FakeYDL
from yt_dlp.cache import Cache
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
import hashlib
+import http.client
import json
import socket
import urllib.error
-import http.client
from test.helper import (
assertGreaterEqual,
report_warning,
try_rm,
)
+
import yt_dlp.YoutubeDL # isort: split
from yt_dlp.compat import compat_HTTPError
from yt_dlp.extractor import get_info_extractor
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
import unittest
-import http.server
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+import http.server
import re
import threading
-from test.helper import http_server_port, try_rm
+from test.helper import http_server_port, try_rm
from yt_dlp import YoutubeDL
from yt_dlp.downloader.http import HttpFD
from yt_dlp.utils import encodeFilename
#!/usr/bin/env python3
-import contextlib
+
+# Allow direct execution
import os
-import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import contextlib
+import subprocess
+
from yt_dlp.utils import encodeArgument
rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
import unittest
-import http.server
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+import http.server
import ssl
import threading
import urllib.request
-from test.helper import http_server_port
+from test.helper import http_server_port
from yt_dlp import YoutubeDL
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
#!/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__))))
-from test.helper import FakeYDL, is_download_test
+from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import IqiyiIE
#!/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__))))
+
from yt_dlp.jsinterp import JSInterpreter
+#!/usr/bin/env python3
+
+# Allow direct execution
import os
import sys
import unittest
#!/usr/bin/env python3
+
+# Allow direct execution
import os
-import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import subprocess
+
from test.helper import is_download_test, try_rm
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
#!/usr/bin/env python3
+
+# Allow direct execution
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, 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: split
from yt_dlp.utils import DownloadError
#!/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__))))
+
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_shlex_quote
from yt_dlp.postprocessor import (
#!/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 random
import subprocess
import urllib.request
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
#!/usr/bin/env python3
+
# Allow direct execution
-import contextlib
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-# Various small unit tests
+import contextlib
import io
import itertools
import json
#!/usr/bin/env python3
+
+# Allow direct execution
import os
-import subprocess
import sys
import unittest
sys.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__)))
#!/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 xml.etree.ElementTree
-from test.helper import get_params, is_download_test, try_rm
import yt_dlp.extractor
import yt_dlp.YoutubeDL
+from test.helper import get_params, is_download_test, try_rm
class YoutubeDL(yt_dlp.YoutubeDL):
#!/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__))))
-from test.helper import FakeYDL, is_download_test
+from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import YoutubeIE, YoutubeTabIE
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
#!/usr/bin/env python3
+
# Allow direct execution
-import contextlib
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import contextlib
import re
import string
import urllib.request
-from test.helper import FakeYDL, is_download_test
+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
-#!/usr/bin/env python3
import collections
import contextlib
import datetime
-#!/usr/bin/env python3
f'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'
#!/usr/bin/env python3
+
# Execute with
# $ python -m yt_dlp
from ._deprecated import * # noqa: F401, F403
from .compat_utils import passthrough_module
-
# XXX: Implement this the same way as other DeprecationWarnings without circular import
try:
passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
import xml.etree.ElementTree as etree
from subprocess import DEVNULL
-from .compat_utils import passthrough_module
+from .compat_utils import passthrough_module # isort: split
from .asyncio import run as compat_asyncio_run # noqa: F401
from .re import Pattern as compat_Pattern # noqa: F401
from .re import match as compat_Match # noqa: F401
from ..dependencies import brotli as compat_brotli # noqa: F401
from ..dependencies import websockets as compat_websockets # noqa: F401
-
passthrough_module(__name__, '...utils', ('WINDOWS_VT_MODE', 'windows_enable_vt_mode'))
import sys
import types
-
_NO_ATTRIBUTE = object()
_Package = collections.namedtuple('Package', ('name', 'version'))
import contextlib
import ctypes
+import http.cookiejar
import json
import os
import shutil
from datetime import datetime, timedelta, timezone
from enum import Enum, auto
from hashlib import pbkdf2_hmac
-import http.cookiejar
from .aes import (
aes_cbc_decrypt_bytes,
+import http.client
import os
import random
import socket
import ssl
import time
import urllib.error
-import http.client
from .common import FileDownloader
from ..utils import (
import collections
import getpass
import hashlib
+import http.client
+import http.cookiejar
+import http.cookies
import itertools
import json
import math
import time
import urllib.request
import xml.etree.ElementTree
-import http.client
-import http.cookiejar
-import http.cookies
from ..compat import functools, re # isort: split
from ..compat import (
int_or_none,
mimetype2ext,
remove_end,
+ strip_or_none,
+ unified_strdate,
url_or_none,
urljoin,
- unified_strdate,
- strip_or_none,
)
import itertools
import json
import time
-import urllib.parse
import urllib.error
+import urllib.parse
from .common import InfoExtractor
from ..utils import ExtractorError, parse_iso8601, try_get
-
-
import urllib.parse
from .common import InfoExtractor
-
-
import urllib.parse
from .common import InfoExtractor
-#!/usr/bin/env python3
import atexit
import base64
import binascii
import hmac
import html.entities
import html.parser
+import http.client
+import http.cookiejar
import importlib.util
import io
import itertools
import urllib.request
import xml.etree.ElementTree
import zlib
-import http.client
-import http.cookiejar
from .compat import asyncio, functools # isort: split
from .compat import (