This commit is contained in:
pukkandan 2022-12-21 20:34:30 +00:00 committed by GitHub
commit f99ef14e7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
612 changed files with 1541 additions and 3893 deletions

View file

@ -66,16 +66,10 @@ jobs:
env: env:
YTDL_TEST_SET: ${{ matrix.ytdl-test-set }} YTDL_TEST_SET: ${{ matrix.ytdl-test-set }}
run: ./devscripts/run_tests.${{ matrix.run-tests-ext }} run: ./devscripts/run_tests.${{ matrix.run-tests-ext }}
flake8: pre_commit:
name: Linter name: Linter
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python - uses: actions/setup-python@v4
uses: actions/setup-python@v2 - uses: pre-commit/action@v3.0.0
with:
python-version: 3.9
- name: Install flake8
run: pip install flake8
- name: Run flake8
run: flake8 .

13
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,13 @@
repos:
- repo: https://github.com/pycqa/isort
rev: v5.11.3
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8

View file

@ -2,8 +2,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
from os.path import dirname as dirn
import sys import sys
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
import youtube_dl import youtube_dl

View file

@ -3,18 +3,18 @@
import argparse import argparse
import ctypes import ctypes
import functools import functools
import os.path
import shutil import shutil
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
import threading import threading
import traceback import traceback
import os.path
sys.path.insert(0, os.path.dirname(os.path.dirname((os.path.abspath(__file__))))) sys.path.insert(0, os.path.dirname(os.path.dirname((os.path.abspath(__file__)))))
from youtube_dl.compat import ( from youtube_dl.compat import (
compat_input,
compat_http_server, compat_http_server,
compat_input,
compat_str, compat_str,
compat_urlparse, compat_urlparse,
) )
@ -429,5 +429,6 @@ class BuildHTTPRequestHandler(compat_http_server.BaseHTTPRequestHandler):
else: else:
self.send_response(500, 'Malformed URL') self.send_response(500, 'Malformed URL')
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

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

View file

@ -18,10 +18,7 @@ from youtube_dl.compat import (
compat_print, compat_print,
compat_urllib_request, compat_urllib_request,
) )
from youtube_dl.utils import ( from youtube_dl.utils import make_HTTPS_handler, sanitized_Request
make_HTTPS_handler,
sanitized_Request,
)
class GitHubReleaser(object): class GitHubReleaser(object):

View file

@ -3,8 +3,8 @@ from __future__ import unicode_literals
import optparse import optparse
import os import os
from os.path import dirname as dirn
import sys import sys
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
import youtube_dl import youtube_dl

View file

@ -1,14 +1,14 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import codecs import codecs
import subprocess
import os import os
import subprocess
import sys import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.utils import intlist_to_bytes
from youtube_dl.aes import aes_encrypt, key_expansion from youtube_dl.aes import aes_encrypt, key_expansion
from youtube_dl.utils import intlist_to_bytes
secret_msg = b'Secret message goes here' secret_msg = b'Secret message goes here'

View file

@ -1,11 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from __future__ import unicode_literals from __future__ import unicode_literals
import json
import sys
import hashlib import hashlib
import json
import os.path import os.path
import sys
if len(sys.argv) <= 1: if len(sys.argv) <= 1:
print('Specify the version number as parameter') print('Specify the version number as parameter')

View file

@ -1,10 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from __future__ import unicode_literals, with_statement from __future__ import unicode_literals, with_statement
import rsa
import json import json
from binascii import hexlify from binascii import hexlify
import rsa
try: try:
input = raw_input input = raw_input
except NameError: except NameError:

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8 # coding: utf-8
from __future__ import with_statement, unicode_literals from __future__ import unicode_literals, with_statement
import datetime import datetime
import glob import glob

View file

@ -6,7 +6,6 @@ import io
import json import json
import textwrap import textwrap
atom_template = textwrap.dedent("""\ atom_template = textwrap.dedent("""\
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
@ -40,8 +39,7 @@ now_iso = now.isoformat() + 'Z'
atom_template = atom_template.replace('@TIMESTAMP@', now_iso) atom_template = atom_template.replace('@TIMESTAMP@', now_iso)
versions_info = json.load(open('update/versions.json')) versions_info = json.load(open('update/versions.json'))
versions = list(versions_info['versions'].keys()) versions = sorted(versions_info['versions'].keys())
versions.sort()
entries = [] entries = []
for v in versions: for v in versions:

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from __future__ import unicode_literals from __future__ import unicode_literals
import sys
import os import os
import sys
import textwrap import textwrap
# We must be able to import youtube_dl # We must be able to import youtube_dl

View file

@ -25,5 +25,6 @@ def main():
with io.open(outfile, 'w', encoding='utf-8') as outf: with io.open(outfile, 'w', encoding='utf-8') as outf:
outf.write(out) outf.write(out)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -1,10 +1,10 @@
from __future__ import unicode_literals, print_function from __future__ import print_function, unicode_literals
from inspect import getsource
import io import io
import os import os
from os.path import dirname as dirn
import sys import sys
from inspect import getsource
from os.path import dirname as dirn
print('WARNING: Lazy loading extractors is an experimental feature that may not always work', file=sys.stderr) print('WARNING: Lazy loading extractors is an experimental feature that may not always work', file=sys.stderr)

View file

@ -1,8 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import io import io
import sys
import re import re
import sys
README_FILE = 'README.md' README_FILE = 'README.md'
helptext = sys.stdin.read() helptext = sys.stdin.read()

View file

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

View file

@ -9,10 +9,7 @@ import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.compat import ( from youtube_dl.compat import compat_print, compat_urllib_request
compat_print,
compat_urllib_request,
)
from youtube_dl.utils import format_bytes from youtube_dl.utils import format_bytes

View file

@ -2,8 +2,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
from os.path import dirname as dirn
import sys import sys
from os.path import dirname as dirn
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
import youtube_dl import youtube_dl

View file

@ -12,8 +12,9 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import sys
import os import os
import sys
# Allows to import youtube_dl # Allows to import youtube_dl
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -45,6 +46,7 @@ copyright = u'2014, Ricardo Garcia Gonzalez'
# #
# The short X.Y version. # The short X.Y version.
from youtube_dl.version import __version__ from youtube_dl.version import __version__
version = __version__ version = __version__
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = version release = version

View file

@ -2,5 +2,18 @@
universal = True universal = True
[flake8] [flake8]
exclude = youtube_dl/extractor/__init__.py,devscripts/buildserver.py,devscripts/lazy_load_template.py,devscripts/make_issue_template.py,setup.py,build,.git,venv exclude = build,venv,.tox,.git,.pytest_cache,devscripts/buildserver.py
ignore = E402,E501,E731,E741,W503 ignore = E402,E501,E731,E741,W503
max_line_length = 80
per_file_ignores =
devscripts/lazy_load_template.py: F401
[isort]
py_version = 27
multi_line_output = VERTICAL_HANGING_INDENT
line_length = 80
reverse_relative = true
ensure_newline_before_comments = true
include_trailing_comma = true
known_first_party =
test

View file

@ -4,21 +4,21 @@
from __future__ import print_function from __future__ import print_function
import os.path import os.path
import warnings
import sys import sys
import warnings
try: try:
from setuptools import setup, Command from setuptools import Command, setup
setuptools_available = True setuptools_available = True
except ImportError: except ImportError:
from distutils.core import setup, Command from distutils.core import Command, setup
setuptools_available = False setuptools_available = False
from distutils.spawn import spawn from distutils.spawn import spawn
try: try:
# This will create an exe that needs Microsoft Visual C++ 2008 # This will create an exe that needs Microsoft Visual C++ 2008
# Redistributable Package # Redistributable Package
import py2exe import py2exe # noqa: F401
except ImportError: except ImportError:
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe': if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
print('Cannot import py2exe', file=sys.stderr) print('Cannot import py2exe', file=sys.stderr)
@ -42,11 +42,11 @@ LONG_DESCRIPTION = 'Command-line program to download videos from YouTube.com and
py2exe_console = [{ py2exe_console = [{
'script': './youtube_dl/__main__.py', 'script': './youtube_dl/__main__.py',
'dest_base': 'youtube-dl', 'dest_base': 'youtube-dl',
'version': __version__, 'version': __version__, # noqa: F821
'description': DESCRIPTION, 'description': DESCRIPTION,
'comments': LONG_DESCRIPTION, 'comments': LONG_DESCRIPTION,
'product_name': 'youtube-dl', 'product_name': 'youtube-dl',
'product_version': __version__, 'product_version': __version__, # noqa: F821
}] }]
py2exe_params = { py2exe_params = {
@ -83,6 +83,7 @@ else:
else: else:
params['scripts'] = ['bin/youtube-dl'] params['scripts'] = ['bin/youtube-dl']
class build_lazy_extractors(Command): class build_lazy_extractors(Command):
description = 'Build the extractor lazy loading module' description = 'Build the extractor lazy loading module'
user_options = [] user_options = []
@ -99,9 +100,10 @@ class build_lazy_extractors(Command):
dry_run=self.dry_run, dry_run=self.dry_run,
) )
setup( setup(
name='youtube_dl', name='youtube_dl',
version=__version__, version=__version__, # noqa: F821
description=DESCRIPTION, description=DESCRIPTION,
long_description=LONG_DESCRIPTION, long_description=LONG_DESCRIPTION,
url='https://github.com/ytdl-org/youtube-dl', url='https://github.com/ytdl-org/youtube-dl',

View file

@ -1,25 +1,19 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import errno import errno
import io
import hashlib import hashlib
import io
import json import json
import os.path import os.path
import re import re
import types
import ssl import ssl
import sys import sys
import types
import youtube_dl.extractor import youtube_dl.extractor
from youtube_dl import YoutubeDL from youtube_dl import YoutubeDL
from youtube_dl.compat import ( from youtube_dl.compat import compat_os_name, compat_str
compat_os_name, from youtube_dl.utils import preferredencoding, write_string
compat_str,
)
from youtube_dl.utils import (
preferredencoding,
write_string,
)
def get_params(override=None): def get_params(override=None):

View file

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

View file

@ -7,6 +7,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import copy import copy

View file

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

View file

@ -6,12 +6,21 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text, aes_ecb_encrypt
from youtube_dl.utils import bytes_to_intlist, intlist_to_bytes
import base64 import base64
from youtube_dl.aes import (
aes_cbc_decrypt,
aes_cbc_encrypt,
aes_decrypt,
aes_decrypt_text,
aes_ecb_encrypt,
aes_encrypt,
)
from youtube_dl.utils import bytes_to_intlist, intlist_to_bytes
# the encrypted data can be generate with 'devscripts/generate_aes_testdata.py' # the encrypted data can be generate with 'devscripts/generate_aes_testdata.py'

View file

@ -5,11 +5,10 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import try_rm from test.helper import try_rm
from youtube_dl import YoutubeDL from youtube_dl import YoutubeDL

View file

@ -2,21 +2,18 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import collections
# Allow direct execution # Allow direct execution
import os import os
import sys import sys
import unittest import unittest
import collections
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import gettestcases from test.helper import gettestcases
from youtube_dl.extractor import FacebookIE, YoutubeIE, gen_extractors
from youtube_dl.extractor import (
FacebookIE,
gen_extractors,
YoutubeIE,
)
class TestAllURLsMatching(unittest.TestCase): class TestAllURLsMatching(unittest.TestCase):

View file

@ -7,6 +7,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import shutil import shutil

View file

@ -7,16 +7,17 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.compat import ( from youtube_dl.compat import (
compat_casefold, compat_casefold,
compat_getenv,
compat_setenv,
compat_etree_Element, compat_etree_Element,
compat_etree_fromstring, compat_etree_fromstring,
compat_expanduser, compat_expanduser,
compat_getenv,
compat_setenv,
compat_shlex_split, compat_shlex_split,
compat_str, compat_str,
compat_struct_unpack, compat_struct_unpack,

View file

@ -6,38 +6,37 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import (
assertGreaterEqual,
expect_warnings,
get_params,
gettestcases,
expect_info_dict,
try_rm,
report_warning,
)
import hashlib import hashlib
import io import io
import json import json
import socket import socket
import youtube_dl.YoutubeDL import youtube_dl.YoutubeDL
from test.helper import (
assertGreaterEqual,
expect_info_dict,
expect_warnings,
get_params,
gettestcases,
report_warning,
try_rm,
)
from youtube_dl.compat import ( from youtube_dl.compat import (
compat_http_client, compat_http_client,
compat_urllib_error,
compat_HTTPError, compat_HTTPError,
compat_urllib_error,
) )
from youtube_dl.extractor import get_info_extractor
from youtube_dl.utils import ( from youtube_dl.utils import (
DownloadError, DownloadError,
ExtractorError, ExtractorError,
UnavailableVideoError,
error_to_compat_str, error_to_compat_str,
format_bytes, format_bytes,
UnavailableVideoError,
) )
from youtube_dl.extractor import get_info_extractor
RETRIES = 3 RETRIES = 3

View file

@ -7,14 +7,16 @@ import os
import re import re
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 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 test.helper import http_server_port, try_rm
from youtube_dl import YoutubeDL from youtube_dl import YoutubeDL
from youtube_dl.compat import compat_http_server from youtube_dl.compat import compat_http_server
from youtube_dl.downloader.http import HttpFD from youtube_dl.downloader.http import HttpFD
from youtube_dl.utils import encodeFilename from youtube_dl.utils import encodeFilename
import threading
TEST_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DIR = os.path.dirname(os.path.abspath(__file__))

View file

@ -3,11 +3,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest
import sys
import os import os
import subprocess import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.utils import encodeArgument from youtube_dl.utils import encodeArgument

View file

@ -6,13 +6,15 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 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 test.helper import http_server_port
from youtube_dl import YoutubeDL from youtube_dl import YoutubeDL
from youtube_dl.compat import compat_http_server, compat_urllib_request from youtube_dl.compat import compat_http_server, compat_urllib_request
import ssl
import threading
TEST_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DIR = os.path.dirname(os.path.abspath(__file__))

View file

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL from test.helper import FakeYDL

View file

@ -6,13 +6,13 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import math import math
import re import re
from youtube_dl.compat import compat_re_Pattern from youtube_dl.compat import compat_re_Pattern
from youtube_dl.jsinterp import JS_Undefined, JSInterpreter from youtube_dl.jsinterp import JS_Undefined, JSInterpreter

View file

@ -4,12 +4,11 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.extractor import ( from youtube_dl.extractor import gen_extractors
gen_extractors,
)
class TestNetRc(unittest.TestCase): class TestNetRc(unittest.TestCase):

View file

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.options import _hide_login_info from youtube_dl.options import _hide_login_info

View file

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.postprocessor import MetadataFromTitlePP from youtube_dl.postprocessor import MetadataFromTitlePP

View file

@ -6,19 +6,14 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import random import random
import subprocess import subprocess
from test.helper import ( from test.helper import FakeYDL, get_params
FakeYDL, from youtube_dl.compat import compat_str, compat_urllib_request
get_params,
)
from youtube_dl.compat import (
compat_str,
compat_urllib_request,
)
class TestMultipleSocks(unittest.TestCase): class TestMultipleSocks(unittest.TestCase):

View file

@ -5,28 +5,27 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, md5 from test.helper import FakeYDL, md5
from youtube_dl.extractor import ( from youtube_dl.extractor import (
YoutubeIE, NPOIE,
DailymotionIE, NRKTVIE,
TEDIE, TEDIE,
CeskaTelevizeIE,
ComedyCentralIE,
DailymotionIE,
DemocracynowIE,
LyndaIE,
RaiPlayIE,
RTVEALaCartaIE,
ThePlatformFeedIE,
ThePlatformIE,
VikiIE,
VimeoIE, VimeoIE,
WallaIE, WallaIE,
CeskaTelevizeIE, YoutubeIE,
LyndaIE,
NPOIE,
ComedyCentralIE,
NRKTVIE,
RaiPlayIE,
VikiIE,
ThePlatformIE,
ThePlatformFeedIE,
RTVEALaCartaIE,
DemocracynowIE,
) )

View file

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -16,7 +17,6 @@ import subprocess
from youtube_dl.swfinterp import SWFInterpreter from youtube_dl.swfinterp import SWFInterpreter
TEST_DIR = os.path.join( TEST_DIR = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'swftests') os.path.dirname(os.path.abspath(__file__)), 'swftests')

View file

@ -4,6 +4,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import io import io

View file

@ -6,10 +6,12 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import json import json
from youtube_dl.update import rsa_verify from youtube_dl.update import rsa_verify

View file

@ -7,6 +7,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -17,66 +18,86 @@ import json
import re import re
import xml.etree.ElementTree import xml.etree.ElementTree
from youtube_dl.compat import (
compat_chr,
compat_etree_fromstring,
compat_getenv,
compat_os_name,
compat_parse_qs,
compat_setenv,
compat_str,
compat_urlparse,
)
from youtube_dl.utils import ( from youtube_dl.utils import (
DateRange,
ExtractorError,
InAdvancePagedList,
LazyList,
OnDemandPagedList,
age_restricted, age_restricted,
args_to_str, args_to_str,
encode_base_n, base_url,
caesar, caesar,
clean_html, clean_html,
clean_podcast_url, clean_podcast_url,
cli_bool_option,
cli_option,
cli_valueless_option,
date_from_str, date_from_str,
DateRange,
detect_exe_version, detect_exe_version,
determine_ext, determine_ext,
dfxp2srt,
dict_get, dict_get,
encode_base_n,
encode_compat_str, encode_compat_str,
encodeFilename, encodeFilename,
escape_rfc3986, escape_rfc3986,
escape_url, escape_url,
expand_path,
extract_attributes, extract_attributes,
ExtractorError,
find_xpath_attr, find_xpath_attr,
fix_xml_ampersands, fix_xml_ampersands,
float_or_none, float_or_none,
get_element_by_class,
get_element_by_attribute, get_element_by_attribute,
get_elements_by_class, get_element_by_class,
get_elements_by_attribute, get_elements_by_attribute,
get_elements_by_class,
get_first, get_first,
InAdvancePagedList,
int_or_none, int_or_none,
intlist_to_bytes, intlist_to_bytes,
is_html, is_html,
join_nonempty, join_nonempty,
js_to_json, js_to_json,
LazyList,
limit_length, limit_length,
lowercase_escape,
match_str,
merge_dicts, merge_dicts,
mimetype2ext, mimetype2ext,
month_by_name, month_by_name,
multipart_encode, multipart_encode,
ohdave_rsa_encrypt, ohdave_rsa_encrypt,
OnDemandPagedList,
orderedSet, orderedSet,
parse_age_limit, parse_age_limit,
parse_bitrate,
parse_codecs,
parse_count,
parse_dfxp_time_expr,
parse_duration, parse_duration,
parse_filesize, parse_filesize,
parse_count,
parse_iso8601, parse_iso8601,
parse_resolution, parse_resolution,
parse_bitrate,
pkcs1pad, pkcs1pad,
prepend_extension,
read_batch_urls, read_batch_urls,
remove_end,
remove_quotes,
remove_start,
render_table,
replace_extension,
rot47,
sanitize_filename, sanitize_filename,
sanitize_path, sanitize_path,
sanitize_url, sanitize_url,
expand_path,
prepend_extension,
replace_extension,
remove_start,
remove_end,
remove_quotes,
rot47,
shell_quote, shell_quote,
smuggle_url, smuggle_url,
str_to_int, str_to_int,
@ -90,39 +111,19 @@ from youtube_dl.utils import (
unified_strdate, unified_strdate,
unified_timestamp, unified_timestamp,
unsmuggle_url, unsmuggle_url,
update_url_query,
uppercase_escape, uppercase_escape,
lowercase_escape,
url_basename, url_basename,
url_or_none, url_or_none,
base_url,
urljoin,
urlencode_postdata, urlencode_postdata,
urljoin,
urshift, urshift,
update_url_query,
variadic, variadic,
version_tuple, version_tuple,
xpath_with_ns, xpath_attr,
xpath_element, xpath_element,
xpath_text, xpath_text,
xpath_attr, xpath_with_ns,
render_table,
match_str,
parse_dfxp_time_expr,
dfxp2srt,
cli_option,
cli_valueless_option,
cli_bool_option,
parse_codecs,
)
from youtube_dl.compat import (
compat_chr,
compat_etree_fromstring,
compat_getenv,
compat_os_name,
compat_setenv,
compat_str,
compat_urlparse,
compat_parse_qs,
) )

View file

@ -3,11 +3,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest
import sys
import os import os
import subprocess import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 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__))) rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View file

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

View file

@ -6,15 +6,11 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL from test.helper import FakeYDL
from youtube_dl.extractor import YoutubeIE, YoutubePlaylistIE, YoutubeTabIE
from youtube_dl.extractor import (
YoutubeIE,
YoutubePlaylistIE,
YoutubeTabIE,
)
class TestYoutubeLists(unittest.TestCase): class TestYoutubeLists(unittest.TestCase):

View file

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

View file

@ -6,15 +6,15 @@ from __future__ import unicode_literals
import os import os
import sys import sys
import unittest import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import io import io
import re import re
import string import string
from youtube_dl.compat import compat_str, compat_urlretrieve
from test.helper import FakeYDL from test.helper import FakeYDL
from youtube_dl.compat import compat_str, compat_urlretrieve
from youtube_dl.extractor import YoutubeIE from youtube_dl.extractor import YoutubeIE
from youtube_dl.jsinterp import JSInterpreter from youtube_dl.jsinterp import JSInterpreter

View file

@ -16,18 +16,18 @@ import locale
import operator import operator
import os import os
import platform import platform
import random
import re import re
import shutil import shutil
import subprocess
import socket import socket
import subprocess
import sys import sys
import time import time
import tokenize import tokenize
import traceback import traceback
import random
from string import ascii_letters from string import ascii_letters
from .cache import Cache
from .compat import ( from .compat import (
compat_basestring, compat_basestring,
compat_cookiejar, compat_cookiejar,
@ -42,64 +42,10 @@ from .compat import (
compat_urllib_request, compat_urllib_request,
compat_urllib_request_DataHandler, compat_urllib_request_DataHandler,
) )
from .utils import (
age_restricted,
args_to_str,
ContentTooShortError,
date_from_str,
DateRange,
DEFAULT_OUTTMPL,
determine_ext,
determine_protocol,
DownloadError,
encode_compat_str,
encodeFilename,
error_to_compat_str,
expand_path,
ExtractorError,
format_bytes,
formatSeconds,
GeoRestrictedError,
int_or_none,
ISO3166Utils,
locked_file,
make_HTTPS_handler,
MaxDownloadsReached,
orderedSet,
PagedList,
parse_filesize,
PerRequestProxyHandler,
platform_name,
PostProcessingError,
preferredencoding,
prepend_extension,
process_communicate_or_kill,
register_socks_protocols,
render_table,
replace_extension,
SameFileError,
sanitize_filename,
sanitize_path,
sanitize_url,
sanitized_Request,
std_headers,
str_or_none,
subtitles_filename,
UnavailableVideoError,
url_basename,
version_tuple,
write_json_file,
write_string,
YoutubeDLCookieJar,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
YoutubeDLRedirectHandler,
)
from .cache import Cache
from .extractor import get_info_extractor, gen_extractor_classes, _LAZY_LOADER
from .extractor.openload import PhantomJSwrapper
from .downloader import get_suitable_downloader from .downloader import get_suitable_downloader
from .downloader.rtmp import rtmpdump_version from .downloader.rtmp import rtmpdump_version
from .extractor import _LAZY_LOADER, gen_extractor_classes, get_info_extractor
from .extractor.openload import PhantomJSwrapper
from .postprocessor import ( from .postprocessor import (
FFmpegFixupM3u8PP, FFmpegFixupM3u8PP,
FFmpegFixupM4aPP, FFmpegFixupM4aPP,
@ -108,6 +54,59 @@ from .postprocessor import (
FFmpegPostProcessor, FFmpegPostProcessor,
get_postprocessor, get_postprocessor,
) )
from .utils import (
DEFAULT_OUTTMPL,
ContentTooShortError,
DateRange,
DownloadError,
ExtractorError,
GeoRestrictedError,
ISO3166Utils,
MaxDownloadsReached,
PagedList,
PerRequestProxyHandler,
PostProcessingError,
SameFileError,
UnavailableVideoError,
YoutubeDLCookieJar,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
YoutubeDLRedirectHandler,
age_restricted,
args_to_str,
date_from_str,
determine_ext,
determine_protocol,
encode_compat_str,
encodeFilename,
error_to_compat_str,
expand_path,
format_bytes,
formatSeconds,
int_or_none,
locked_file,
make_HTTPS_handler,
orderedSet,
parse_filesize,
platform_name,
preferredencoding,
prepend_extension,
process_communicate_or_kill,
register_socks_protocols,
render_table,
replace_extension,
sanitize_filename,
sanitize_path,
sanitize_url,
sanitized_Request,
std_headers,
str_or_none,
subtitles_filename,
url_basename,
version_tuple,
write_json_file,
write_string,
)
from .version import __version__ from .version import __version__
if compat_os_name == 'nt': if compat_os_name == 'nt':

View file

@ -11,37 +11,32 @@ import os
import random import random
import sys import sys
from .options import (
parseOpts,
)
from .compat import ( from .compat import (
compat_getpass, compat_getpass,
compat_shlex_split, compat_shlex_split,
workaround_optparse_bug9161, workaround_optparse_bug9161,
) )
from .downloader import FileDownloader
from .extractor import gen_extractors, list_extractors
from .extractor.adobepass import MSO_INFO
from .options import parseOpts
from .update import update_self
from .utils import ( from .utils import (
DateRange,
decodeOption,
DEFAULT_OUTTMPL, DEFAULT_OUTTMPL,
DateRange,
DownloadError, DownloadError,
MaxDownloadsReached,
SameFileError,
decodeOption,
expand_path, expand_path,
match_filter_func, match_filter_func,
MaxDownloadsReached,
preferredencoding, preferredencoding,
read_batch_urls, read_batch_urls,
SameFileError, render_table,
setproctitle, setproctitle,
std_headers, std_headers,
write_string, write_string,
render_table,
) )
from .update import update_self
from .downloader import (
FileDownloader,
)
from .extractor import gen_extractors, list_extractors
from .extractor.adobepass import MSO_INFO
from .YoutubeDL import YoutubeDL from .YoutubeDL import YoutubeDL

View file

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import unicode_literals from __future__ import unicode_literals
import sys
# Execute with # Execute with
# $ python youtube_dl/__main__.py (2.6+) # $ python youtube_dl/__main__.py (2.6+)
# $ python -m youtube_dl (2.7+) # $ python -m youtube_dl (2.7+)
import sys
if __package__ is None and not hasattr(sys, 'frozen'): if __package__ is None and not hasattr(sys, 'frozen'):
# direct call of __main__.py # direct call of __main__.py

View file

@ -1,10 +1,7 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
from .compat import ( from .compat import compat_chr, compat_str
compat_str,
compat_chr,
)
# Below is included the text of icu/CaseFolding.txt retrieved from # Below is included the text of icu/CaseFolding.txt retrieved from
# https://github.com/unicode-org/icu/blob/main/icu4c/source/data/unidata/CaseFolding.txt # https://github.com/unicode-org/icu/blob/main/icu4c/source/data/unidata/CaseFolding.txt

View file

@ -2387,9 +2387,10 @@ except ImportError:
import BaseHTTPServer as compat_http_server import BaseHTTPServer as compat_http_server
try: try:
from urllib.parse import unquote_to_bytes as compat_urllib_parse_unquote_to_bytes
from urllib.parse import unquote as compat_urllib_parse_unquote from urllib.parse import unquote as compat_urllib_parse_unquote
from urllib.parse import unquote_plus as compat_urllib_parse_unquote_plus from urllib.parse import unquote_plus as compat_urllib_parse_unquote_plus
from urllib.parse import \
unquote_to_bytes as compat_urllib_parse_unquote_to_bytes
except ImportError: # Python 2 except ImportError: # Python 2
_asciire = (compat_urllib_parse._asciire if hasattr(compat_urllib_parse, '_asciire') _asciire = (compat_urllib_parse._asciire if hasattr(compat_urllib_parse, '_asciire')
else re.compile(r'([\x00-\x7f]+)')) else re.compile(r'([\x00-\x7f]+)'))
@ -2684,7 +2685,7 @@ except (AssertionError, UnicodeEncodeError):
def compat_ord(c): def compat_ord(c):
if type(c) is int: if isinstance(c, int):
return c return c
else: else:
return ord(c) return ord(c)
@ -3001,6 +3002,7 @@ except ImportError:
# new class in collections # new class in collections
try: try:
from collections import ChainMap as compat_collections_chain_map from collections import ChainMap as compat_collections_chain_map
# Py3.3's ChainMap is deficient # Py3.3's ChainMap is deficient
if sys.version_info < (3, 4): if sys.version_info < (3, 4):
raise ImportError raise ImportError

View file

@ -1,8 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from ..utils import ( from ..utils import determine_protocol
determine_protocol,
)
def get_suitable_downloader(info_dict, params={}): def get_suitable_downloader(info_dict, params={}):
@ -14,17 +12,14 @@ def get_suitable_downloader(info_dict, params={}):
# Some of these require get_suitable_downloader # Some of these require get_suitable_downloader
from .common import FileDownloader from .common import FileDownloader
from .dash import DashSegmentsFD from .dash import DashSegmentsFD
from .external import FFmpegFD, get_external_downloader
from .f4m import F4mFD from .f4m import F4mFD
from .hls import HlsFD from .hls import HlsFD
from .http import HttpFD from .http import HttpFD
from .rtmp import RtmpFD
from .rtsp import RtspFD
from .ism import IsmFD from .ism import IsmFD
from .niconico import NiconicoDmcFD from .niconico import NiconicoDmcFD
from .external import ( from .rtmp import RtmpFD
get_external_downloader, from .rtsp import RtspFD
FFmpegFD,
)
PROTOCOL_MAP = { PROTOCOL_MAP = {
'rtmp': RtmpFD, 'rtmp': RtmpFD,

View file

@ -1,10 +1,10 @@
from __future__ import division, unicode_literals from __future__ import division, unicode_literals
import os import os
import random
import re import re
import sys import sys
import time import time
import random
from ..compat import compat_os_name from ..compat import compat_os_name
from ..utils import ( from ..utils import (

View file

@ -2,10 +2,7 @@ from __future__ import unicode_literals
from .fragment import FragmentFD from .fragment import FragmentFD
from ..compat import compat_urllib_error from ..compat import compat_urllib_error
from ..utils import ( from ..utils import DownloadError, urljoin
DownloadError,
urljoin,
)
class DashSegmentsFD(FragmentFD): class DashSegmentsFD(FragmentFD):

View file

@ -7,20 +7,17 @@ import sys
import time import time
from .common import FileDownloader from .common import FileDownloader
from ..compat import ( from ..compat import compat_setenv, compat_str
compat_setenv, from ..postprocessor.ffmpeg import EXT_TO_OUT_FORMATS, FFmpegPostProcessor
compat_str,
)
from ..postprocessor.ffmpeg import FFmpegPostProcessor, EXT_TO_OUT_FORMATS
from ..utils import ( from ..utils import (
cli_option, check_executable,
cli_valueless_option,
cli_bool_option, cli_bool_option,
cli_configuration_args, cli_configuration_args,
encodeFilename, cli_option,
cli_valueless_option,
encodeArgument, encodeArgument,
encodeFilename,
handle_youtubedl_headers, handle_youtubedl_headers,
check_executable,
is_outdated_version, is_outdated_version,
process_communicate_or_kill, process_communicate_or_kill,
) )

View file

@ -8,16 +8,13 @@ from .fragment import FragmentFD
from ..compat import ( from ..compat import (
compat_b64decode, compat_b64decode,
compat_etree_fromstring, compat_etree_fromstring,
compat_urlparse,
compat_urllib_error,
compat_urllib_parse_urlparse,
compat_struct_pack, compat_struct_pack,
compat_struct_unpack, compat_struct_unpack,
compat_urllib_error,
compat_urllib_parse_urlparse,
compat_urlparse,
) )
from ..utils import ( from ..utils import fix_xml_ampersands, xpath_text
fix_xml_ampersands,
xpath_text,
)
class DataTruncatedError(Exception): class DataTruncatedError(Exception):

View file

@ -1,14 +1,14 @@
from __future__ import division, unicode_literals from __future__ import division, unicode_literals
import json
import os import os
import time import time
import json
from .common import FileDownloader from .common import FileDownloader
from .http import HttpFD from .http import HttpFD
from ..utils import ( from ..utils import (
error_to_compat_str,
encodeFilename, encodeFilename,
error_to_compat_str,
sanitize_open, sanitize_open,
sanitized_Request, sanitized_Request,
) )

View file

@ -1,25 +1,18 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
import binascii import binascii
import re
try: try:
from Crypto.Cipher import AES from Crypto.Cipher import AES
can_decrypt_frag = True can_decrypt_frag = True
except ImportError: except ImportError:
can_decrypt_frag = False can_decrypt_frag = False
from .fragment import FragmentFD
from .external import FFmpegFD from .external import FFmpegFD
from .fragment import FragmentFD
from ..compat import ( from ..compat import compat_struct_pack, compat_urllib_error, compat_urlparse
compat_urllib_error, from ..utils import parse_m3u8_attributes, update_url_query
compat_urlparse,
compat_struct_pack,
)
from ..utils import (
parse_m3u8_attributes,
update_url_query,
)
class HlsFD(FragmentFD): class HlsFD(FragmentFD):

View file

@ -2,25 +2,22 @@ from __future__ import unicode_literals
import errno import errno
import os import os
import socket
import time
import random import random
import re import re
import socket
import time
from .common import FileDownloader from .common import FileDownloader
from ..compat import ( from ..compat import compat_str, compat_urllib_error
compat_str,
compat_urllib_error,
)
from ..utils import ( from ..utils import (
ContentTooShortError, ContentTooShortError,
XAttrMetadataError,
XAttrUnavailableError,
encodeFilename, encodeFilename,
int_or_none, int_or_none,
sanitize_open, sanitize_open,
sanitized_Request, sanitized_Request,
write_xattr, write_xattr,
XAttrMetadataError,
XAttrUnavailableError,
) )

View file

@ -1,15 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import time
import binascii import binascii
import io import io
import time
from .fragment import FragmentFD from .fragment import FragmentFD
from ..compat import ( from ..compat import compat_Struct, compat_urllib_error
compat_Struct,
compat_urllib_error,
)
u8 = compat_Struct('>B') u8 = compat_Struct('>B')
u88 = compat_Struct('>Bx') u88 = compat_Struct('>Bx')

View file

@ -9,8 +9,8 @@ from .common import FileDownloader
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import (
check_executable, check_executable,
encodeFilename,
encodeArgument, encodeArgument,
encodeFilename,
get_exe_version, get_exe_version,
) )

View file

@ -4,10 +4,7 @@ import os
import subprocess import subprocess
from .common import FileDownloader from .common import FileDownloader
from ..utils import ( from ..utils import check_executable, encodeFilename
check_executable,
encodeFilename,
)
class RtspFD(FileDownloader): class RtspFD(FileDownloader):

View file

@ -1,19 +1,19 @@
from __future__ import unicode_literals from __future__ import unicode_literals
try: try:
from .lazy_extractors import * from .lazy_extractors import * # noqa: F403
from .lazy_extractors import _ALL_CLASSES from .lazy_extractors import _ALL_CLASSES
_LAZY_LOADER = True _LAZY_LOADER = True
except ImportError: except ImportError:
_LAZY_LOADER = False _LAZY_LOADER = False
from .extractors import * from .extractors import * # noqa: F403
_ALL_CLASSES = [ _ALL_CLASSES = [
klass klass
for name, klass in globals().items() for name, klass in globals().items()
if name.endswith('IE') and name != 'GenericIE' if name.endswith('IE') and name != 'GenericIE'
] ]
_ALL_CLASSES.append(GenericIE) _ALL_CLASSES.append(GenericIE) # noqa: F405
def gen_extractor_classes(): def gen_extractor_classes():

View file

@ -9,8 +9,8 @@ from .common import InfoExtractor
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
js_to_json,
int_or_none, int_or_none,
js_to_json,
parse_iso8601, parse_iso8601,
try_get, try_get,
unescapeHTML, unescapeHTML,

View file

@ -5,11 +5,7 @@ import re
from .amp import AMPIE from .amp import AMPIE
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import parse_duration, parse_iso8601, try_get
parse_duration,
parse_iso8601,
try_get,
)
class AbcNewsVideoIE(AMPIE): class AbcNewsVideoIE(AMPIE):

View file

@ -5,11 +5,7 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import dict_get, int_or_none, try_get
dict_get,
int_or_none,
try_get,
)
class ABCOTVSIE(InfoExtractor): class ABCOTVSIE(InfoExtractor):

View file

@ -4,12 +4,7 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import clean_html, clean_podcast_url, int_or_none, parse_iso8601
clean_html,
clean_podcast_url,
int_or_none,
parse_iso8601,
)
class ACastBaseIE(InfoExtractor): class ACastBaseIE(InfoExtractor):

View file

@ -9,15 +9,11 @@ import random
from .common import InfoExtractor from .common import InfoExtractor
from ..aes import aes_cbc_decrypt from ..aes import aes_cbc_decrypt
from ..compat import ( from ..compat import compat_b64decode, compat_HTTPError, compat_ord
compat_HTTPError,
compat_b64decode,
compat_ord,
)
from ..utils import ( from ..utils import (
ExtractorError,
bytes_to_intlist, bytes_to_intlist,
bytes_to_long, bytes_to_long,
ExtractorError,
float_or_none, float_or_none,
int_or_none, int_or_none,
intlist_to_bytes, intlist_to_bytes,

View file

@ -2,10 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import compat_parse_qs, compat_urlparse
compat_parse_qs,
compat_urlparse,
)
class AdobeConnectIE(InfoExtractor): class AdobeConnectIE(InfoExtractor):

View file

@ -6,19 +6,15 @@ import time
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import compat_kwargs, compat_urlparse
compat_kwargs,
compat_urlparse,
)
from ..utils import ( from ..utils import (
unescapeHTML,
urlencode_postdata,
unified_timestamp,
ExtractorError,
NO_DEFAULT, NO_DEFAULT,
ExtractorError,
unescapeHTML,
unified_timestamp,
urlencode_postdata,
) )
MSO_INFO = { MSO_INFO = {
'DTV': { 'DTV': {
'name': 'DIRECTV', 'name': 'DIRECTV',

View file

@ -6,10 +6,10 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import (
float_or_none,
int_or_none,
ISO639Utils, ISO639Utils,
OnDemandPagedList, OnDemandPagedList,
float_or_none,
int_or_none,
parse_duration, parse_duration,
str_or_none, str_or_none,
str_to_int, str_to_int,

View file

@ -6,8 +6,8 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_xpath from ..compat import compat_xpath
from ..utils import ( from ..utils import (
determine_ext,
ExtractorError, ExtractorError,
determine_ext,
int_or_none, int_or_none,
url_or_none, url_or_none,
urlencode_postdata, urlencode_postdata,

View file

@ -4,11 +4,7 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import int_or_none, parse_duration, parse_iso8601
int_or_none,
parse_duration,
parse_iso8601,
)
class AirMozillaIE(InfoExtractor): class AirMozillaIE(InfoExtractor):

View file

@ -3,10 +3,7 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import float_or_none, try_get
float_or_none,
try_get,
)
class AliExpressLiveIE(InfoExtractor): class AliExpressLiveIE(InfoExtractor):

View file

@ -1,12 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import int_or_none, parse_duration, parse_filesize, parse_iso8601
parse_iso8601,
parse_duration,
parse_filesize,
int_or_none,
)
class AlphaPornoIE(InfoExtractor): class AlphaPornoIE(InfoExtractor):

View file

@ -2,13 +2,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from .youtube import YoutubeIE
from .vimeo import VimeoIE from .vimeo import VimeoIE
from ..utils import ( from .youtube import YoutubeIE
int_or_none, from ..utils import int_or_none, parse_iso8601, update_url_query
parse_iso8601,
update_url_query,
)
class AmaraIE(InfoExtractor): class AmaraIE(InfoExtractor):

View file

@ -4,12 +4,7 @@ from __future__ import unicode_literals
import re import re
from .theplatform import ThePlatformIE from .theplatform import ThePlatformIE
from ..utils import ( from ..utils import int_or_none, parse_age_limit, try_get, update_url_query
int_or_none,
parse_age_limit,
try_get,
update_url_query,
)
class AMCNetworksIE(ThePlatformIE): class AMCNetworksIE(ThePlatformIE):

View file

@ -3,8 +3,8 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
determine_ext,
ExtractorError, ExtractorError,
determine_ext,
int_or_none, int_or_none,
mimetype2ext, mimetype2ext,
parse_iso8601, parse_iso8601,

View file

@ -5,9 +5,9 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import (
ExtractorError,
determine_ext, determine_ext,
extract_attributes, extract_attributes,
ExtractorError,
url_or_none, url_or_none,
urlencode_postdata, urlencode_postdata,
urljoin, urljoin,

View file

@ -14,8 +14,8 @@ from ..compat import compat_str
from ..utils import ( from ..utils import (
bytes_to_intlist, bytes_to_intlist,
determine_ext, determine_ext,
intlist_to_bytes,
int_or_none, int_or_none,
intlist_to_bytes,
strip_jsonp, strip_jsonp,
unescapeHTML, unescapeHTML,
unsmuggle_url, unsmuggle_url,

View file

@ -4,15 +4,8 @@ from __future__ import unicode_literals
import re import re
from .yahoo import YahooIE from .yahoo import YahooIE
from ..compat import ( from ..compat import compat_parse_qs, compat_urllib_parse_urlparse
compat_parse_qs, from ..utils import ExtractorError, int_or_none, url_or_none
compat_urllib_parse_urlparse,
)
from ..utils import (
ExtractorError,
int_or_none,
url_or_none,
)
class AolIE(YahooIE): class AolIE(YahooIE):

View file

@ -4,11 +4,7 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import determine_ext, int_or_none, url_or_none
determine_ext,
int_or_none,
url_or_none,
)
class APAIE(InfoExtractor): class APAIE(InfoExtractor):

View file

@ -2,10 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import ExtractorError, str_to_int
str_to_int,
ExtractorError
)
class AppleConnectIE(InfoExtractor): class AppleConnectIE(InfoExtractor):

View file

@ -1,15 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
import json import json
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urlparse from ..compat import compat_urlparse
from ..utils import ( from ..utils import int_or_none, parse_duration, unified_strdate
int_or_none,
parse_duration,
unified_strdate,
)
class AppleTrailersIE(InfoExtractor): class AppleTrailersIE(InfoExtractor):

View file

@ -4,12 +4,7 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import extract_attributes, int_or_none, parse_iso8601, try_get
extract_attributes,
int_or_none,
parse_iso8601,
try_get,
)
class ArcPublishingIE(InfoExtractor): class ArcPublishingIE(InfoExtractor):

View file

@ -6,9 +6,10 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from .generic import GenericIE from .generic import GenericIE
from ..compat import compat_etree_fromstring
from ..utils import ( from ..utils import (
determine_ext,
ExtractorError, ExtractorError,
determine_ext,
int_or_none, int_or_none,
parse_duration, parse_duration,
qualities, qualities,
@ -20,7 +21,6 @@ from ..utils import (
url_or_none, url_or_none,
xpath_text, xpath_text,
) )
from ..compat import compat_etree_fromstring
class ARDMediathekBaseIE(InfoExtractor): class ARDMediathekBaseIE(InfoExtractor):

View file

@ -2,16 +2,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import compat_parse_qs, compat_urllib_parse_urlparse
compat_parse_qs, from ..utils import float_or_none, int_or_none, parse_iso8601, remove_start
compat_urllib_parse_urlparse,
)
from ..utils import (
float_or_none,
int_or_none,
parse_iso8601,
remove_start,
)
class ArnesIE(InfoExtractor): class ArnesIE(InfoExtractor):

View file

@ -4,10 +4,7 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import compat_str, compat_urlparse
compat_str,
compat_urlparse,
)
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
int_or_none, int_or_none,

View file

@ -7,9 +7,9 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from .kaltura import KalturaIE from .kaltura import KalturaIE
from ..utils import ( from ..utils import (
OnDemandPagedList,
extract_attributes, extract_attributes,
int_or_none, int_or_none,
OnDemandPagedList,
parse_age_limit, parse_age_limit,
strip_or_none, strip_or_none,
try_get, try_get,

View file

@ -5,11 +5,7 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_HTTPError from ..compat import compat_HTTPError
from ..utils import ( from ..utils import ExtractorError, int_or_none, urlencode_postdata
ExtractorError,
int_or_none,
urlencode_postdata,
)
class AtresPlayerIE(InfoExtractor): class AtresPlayerIE(InfoExtractor):

View file

@ -2,11 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import determine_ext, int_or_none, unescapeHTML
determine_ext,
int_or_none,
unescapeHTML,
)
class ATVAtIE(InfoExtractor): class ATVAtIE(InfoExtractor):

View file

@ -2,10 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import int_or_none, parse_iso8601
int_or_none,
parse_iso8601,
)
class AudiMediaIE(InfoExtractor): class AudiMediaIE(InfoExtractor):

View file

@ -2,10 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import clean_html, float_or_none
clean_html,
float_or_none,
)
class AudioBoomIE(InfoExtractor): class AudioBoomIE(InfoExtractor):

View file

@ -7,10 +7,7 @@ import time
from .common import InfoExtractor from .common import InfoExtractor
from .soundcloud import SoundcloudIE from .soundcloud import SoundcloudIE
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import ExtractorError, url_basename
ExtractorError,
url_basename,
)
class AudiomackIE(InfoExtractor): class AudiomackIE(InfoExtractor):

View file

@ -1,14 +1,11 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
import base64 import base64
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import compat_str, compat_urllib_parse_urlencode
compat_urllib_parse_urlencode,
compat_str,
)
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
parse_iso8601, parse_iso8601,

Some files were not shown because too many files have changed in this diff Show more