text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>from __future__ import annotations
import functools
import http.client
import io
import ssl
import urllib.error
import urllib.parse
import urllib.request
import urllib.response
import zlib
from urllib.request import (
DataHandler,
FileHandler,
FTPHandler,
HTTPCookieProcessor,
HTTPDefa... | fim | yt-dlp/yt-dlp | python |
from __future__ import annotations
import contextlib
import functools
import io
import logging
import ssl
import sys
from ._helper import (
create_connection,
create_socks_proxy_socket,
make_socks_proxy_opts,
)
from ..utils.networking import select_proxy
from .common import Features, Response, register_rh... | fim | yt-dlp/yt-dlp | python |
from __future__ import annotations
import abc
import copy
import enum
import functools
import io
import typing
import urllib.parse
import urllib.request
import urllib.response
from collections.abc import Iterable, Mapping
from email.message import Message
from http import HTTPStatus
from types import NoneType
from ._... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>rror(TransportError):
pass
network_exceptions = (HTTPError, TransportError)
<|fim_prefix|>from __future__ import annotations
import typing
from ..utils import YoutubeDLError
if typing.TYPE_CHECKING:
from .common import RequestHandler, Response
class RequestError(YoutubeDLError):
def __i... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>from __future__ import annotations
import re
from abc import ABC
from dataclasses import dataclass
from types import NoneType
from typing import Any
from .common import RequestHandler, register_preference, Request
from .exceptions import UnsupportedRequest
from ..utils import classproperty, join_nonempt... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>ler, abc.ABC):
pass
<|fim_prefix|>from __future__ import annotations
import abc
from .common import RequestHandler, Response
class WebSocketResponse(Response):
def send(self, message: bytes | str):
"""
Send a messag<|fim_middle|>e to the server.
@param message: The me... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>import contextlib
import dataclasses
import functools
import importlib
import importlib.abc
import importlib.machinery
import importlib.util
import inspect
import itertools
import os
import pkgutil
import sys
import traceback
from pathlib import Path
from zipfile import ZipFile
from .globals import (
... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|># flake8: noqa: F401
from .common import PostProcessor
from .embedthumbnail import EmbedThumbnailPP
from .exec import ExecAfterDownloadPP, ExecPP
from .ffmpeg import (
FFmpegConcatPP,
FFmpegCopyStreamPP,
FFmpegEmbedSubtitlePP,
FFmpegExtractAudioPP,
FFmpegFixupDuplicateMoovPP,
FFmp... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>erence is that this
one has an extra field called "filepath" that points to the
downloaded file.
This method returns a tuple, the first element is a list of the files
that can be deleted, and the second of which is the updated
information.
In addition, thi... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>import base64
import os
import re
import subprocess
from .common import PostProcessor
from .ffmpeg import FFmpegPostProcessor, FFmpegThumbnailsConvertorPP
from ..compat import imghdr
from ..dependencies import mutagen
from ..utils import (
Popen,
PostProcessingError,
check_executable,
enc... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>from .common import PostProcessor
from ..utils import Popen, PostProcessingError, shell_quote, variadic
class ExecPP(PostProcessor):
def __init__(self, downloader, exec_cmd):
# Need to set exec_cmd attribute before set_downloader is called by PostProcessor.__init__
self.exec_cmd = v... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>import collections
import contextvars
import functools
import itertools
import json
import os
import re
import subprocess
import time
from .common import PostProcessor
from ..compat import imghdr
from ..utils import (
MEDIA_EXTENSIONS,
ISO639Utils,
Popen,
PostProcessingError,
_get_exe... | fim | yt-dlp/yt-dlp | python |
import re
from .common import PostProcessor
from ..utils import Namespace, filter_dict, function_with_repr
class MetadataParserPP(PostProcessor):
def __init__(self, downloader, actions):
super().__init__(downloader)
self._actions = []
for f in actions:
action, *args = f
... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>import copy
import heapq
import os
from .common import PostProcessor
from .ffmpeg import FFmpegPostProcessor, FFmpegSubtitlesConvertorPP
from .sponsorblock import SponsorBlockPP
from ..utils import PostProcessingError, orderedSet, prepend_extension
_TINY_CHAPTER_DURATION = 1
DEFAULT_SPONSORBLOCK_CHAPTER... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>(oldfile, newfile) # os.rename cannot move between volumes
info['filepath'] = finalpath
return [], info
<|fim_prefix|>import os
from .common import PostProcessor
from ..compat import shutil
from ..utils import (
PostProcessingError,
make_parent_dirs,
)
class MoveFilesAfterDown... | fim | yt-dlp/yt-dlp | python |
import hashlib
import json
import re
import urllib.parse
from .ffmpeg import FFmpegPostProcessor
class SponsorBlockPP(FFmpegPostProcessor):
# https://wiki.sponsor.ajay.app/w/Types
EXTRACTORS = {
'Youtube': 'YouTube',
}
POI_CATEGORIES = {
'poi_highlight': 'Highlight',
}
NON_SKI... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>import os
import sys
from .common import PostProcessor
from ..utils import (
PostProcessingError,
XAttrMetadataError,
XAttrUnavailableError,
hyphenate_date,
write_xattr,
)
class XAttrMetadataPP(PostProcessor):
"""Set extended attributes on downloaded file (if xattr support is fo... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|># Public Domain SOCKS proxy protocol implementation
# Adapted from https://gist.github.com/bluec0re/cafd3764412967417fd3
# References:
# SOCKS4 protocol http://www.openssh.com/txt/socks4.protocol
# SOCKS4A protocol http://www.openssh.com/txt/socks4a.protocol
# SOCKS5 protocol https://tools.ietf.org/html/r... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|> f'The requested tag {self.requested_tag} does not exist for {self.requested_repo}', True)
return None
def _process_update_spec(self, lockfile: str, resolved_tag: str):
lines = lockfile.splitlines()
is_version2 = any(line.startswith('lockV2 ') for line in lines)
... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>put # noqa: F401
<|fim_prefix|># flake8: noqa: F403
from ..compat.compat_utils import p<|fim_middle|>assthrough_module
passthrough_module(__name__, '._deprecated')
del passthrough_module
# isort: off
from .traversal import *
from ._utils import *
from ._utils import _configuration_args, _get_exe_versio... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>64encode(json.dumps(header_data).encode())
payload_b64 = base64.b64encode(json.dumps(payload_data).encode())
h = hmac.new(key.encode(), header_b64 + b'.' + payload_b64, hashlib.sha256)
signature_b64 = base64.b64encode(h.digest())
return header_b64 + b'.' + payload_b64 + b'.' + signature_b6... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>from __future__ import annotations
import abc
import dataclasses
import functools
import os.path
import sys
import sysconfig
from ._utils import _get_exe_version_output, detect_exe_version, version_tuple
_FALLBACK_PATHEXT = ('.COM', '.EXE', '.BAT', '.CMD')
def _find_exe(basename: str) -> str:
# ... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>r_type == 1: # Sub
color = (color + left) & 0xff
elif filter_type == 2: # Up
color = (color + up) & 0xff
elif filter_type == 3: # Average
color = (color + ((left + up) >> 1)) & 0xff
elif filter_type == 4: # Paeth
... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|> JavaScript libraries
<|fim_prefix|># Utilit<|fim_middle|>y functions for handling web input based on commonly used<|endoftext|> | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>from __future__ import annotations
import array
import base64
import datetime as dt
import math
import re
from .._utils import parse_iso8601
TYPE_CHECKING = False
if TYPE_CHECKING:
import collections.abc
import typing
T = typing.TypeVar('T')
_ARRAY_TYPE_LOOKUP = {
'Int8Array': 'b',
... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>mote_dot_segments
# Pseudo-code: https://tools.ietf.org/html/rfc3986#section-5.2.4
# https://github.com/urllib3/urllib3/blob/ba49f5c4e19e6bca6827282feb77a3c9f937e64b/src/urllib3/util/url.py#L263
output = []
segments = path.split('/')
for s in segments:
if s == '.':
... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>from __future__ import annotations
import bisect
import threading
import time
class ProgressCalculator:
# Time to calculate the speed over (seconds)
SAMPLING_WINDOW = 3
# Minimum timeframe before to sample next downloaded bytes (seconds)
SAMPLING_RATE = 0.05
# Time before <|fim_suff... | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>from __future__ import annotations
import collections
import collections.abc
import contextlib
import functools
import http.cookies
import inspect
import itertools
import re
import typing
import xml.etree.ElementTree
from ._utils import (
IDENTITY,
NO_DEFAULT,
ExtractorError,
LazyList,
... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>c3bae8d5'
VARIANT = None
UPDATE_HINT = None
CHANNEL = 'stable'
ORIGIN = 'yt-dlp/yt-dlp'
_pkg_version = '2026.06.09'
<|fim_prefix|># Autogenerated by devscripts/update-version.py
__version__ = '2026.06.09'
RELEASE_GIT_HEAD <|fim_middle|>= '821bef0f00178916d60dbc86bc0bcb8c<|endoftext|> | fim | yt-dlp/yt-dlp | python |
<|fim_prefix|>"""
A partial parser for WebVTT segments. Interprets enough of the WebVTT stream
to be able to assemble a single stand-alone subtitle file, suitably adjusting
timestamps on the way, while everything else is passed through unmodified.
Regular expressions based on the W3C WebVTT specification
<https://www.... | fim | yt-dlp/yt-dlp | python |
<|fim_suffix|>tside
<|fim_prefix|># Empty file needed to make devscripts.utils properly impo<|fim_middle|>rtable from ou<|endoftext|> | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
import os
from os.path import dirname as dirn
import sys
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
import youtube_dl
from youtube_dl.compat import compat_open as open
from utils import read_file
BASH_COMPLETION_FILE = "yout... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>python_path
super(PythonBuilder, self).__init__(**kwargs)
class GITInfoBuilder(object):
def __init__(self, **kwargs):
try:
self.user, self.repoName = kwargs['path'][:2]
self.rev = kwargs.pop('rev')
except ValueError:
raise BuildError('Inva... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
"""
This script employs a VERY basic heuristic ('porn' in webpage.lower()) to check
if we are not 'age_limit' tagging some porn site
A second approach implemented relies on a list of porn domains, to activate it
pass the list filename as the ... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
"""
This script displays the API parameters corresponding to a yt-dl command line
Example:
$ ./cli_to_api.py -f best
{u'format': 'best'}
$
"""
# Allow direct execution
import os
import sys
sys.path.insert(0, os.path.dirname(... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>)
def _init_github_account(self):
try:
info = netrc.netrc().authenticators(self._NETRC_MACHINE)
if info is not None:
self._token = info[2]
compat_print('Using GitHub credentials found in .netrc...')
return
els... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
import optparse
import os
from os.path import dirname as dirn
import sys
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
import youtube_dl
from youtube_dl.utils import shell_quote
from utils import read_file, write_file
FISH_COMP... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>st_to_bytes(int_list), 'hex')
def openssl_encode(algo, key, iv):
cmd = ['openssl', 'enc', '-e', '-' + algo, '-K', hex_str(key), '-iv', hex_str(iv)]
prog = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out, _ = prog.communicate(secret_msg)
return out
iv = key = [0... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>path.join(build_dir, filename)
with open(fn, 'rb') as f:
data = f.read()
if not data:
raise ValueError('File %s is empty!' % fn)
sha256sum = hashlib.sha256(data).hexdigest()
new_version[key] = (url, sha256sum)
versions_info['versions'][version] = new_version
versions_info[... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python3
from __future__ import unicode_literals
import json
import os.path
import sys
dirn = os.path.dirname
sys.path.insert(0, dirn(dirn((os<|fim_suffix|>_VERSION@', version)
template = template.replace('@PROGRAM_URL@', version_dict['bin'][0])
template = template.replace('@PROGRAM_SHA25... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python3
from __future__ import unicode_literals, with_statement
import rsa
import json
from binascii import hexlify
try:
input = raw_input
except NameError:
pass
versions_info = json.load(open('update/versions.json'))
if 'signature' in versions_info:
del versions_info['signat... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>
from youtube_dl import compat_str
year = compat_str(datetime.datetime.now().year)
for fn in glob.glob('*.html*'):
content = read_file(fn)
newc = re.sub(r'(?P<copyright>Copyright © 2011-)(?P<year>[0-9]{4})', 'Copyright © 2011-' + year, content)
if content != newc:
tmpFn = fn + '.part'... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python3
from __future__ import unicode_literals
import datetime
import json
import os.path
import textwrap
import sys
dirn = os.path.dirname
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
from utils import write_file
atom_template = textwrap.dedent("""\
<?xml version="1.... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>.IE_NAME)
ie_desc = getattr(ie, 'IE_DESC', None)
if ie_desc is False:
continue
elif ie_desc is not None:
ie_html += ': {}'.format(ie.IE_DESC)
if not ie.working():
ie_html += ' (Currently broken)'
ie_htmls.append('<li>{}</li>'.form... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|># coding: utf-8
from __future__ impo<|fim_suffix|> real_cls = getattr(mod, cls.__name__)
instance = real_cls.__new__(real_cls)
instance.__init__(*args, **kwargs)
return instance
<|fim_middle|>rt unicode_literals
import re
class LazyLoadExtractor(object):
_module = None
... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
import optparse
import re
from utils import read_file,<|fim_suffix|>args()
if len(args) != 2:
parser.error('Expected an input and an output filename')
infile, outfile = args
readme = read_file(infile)
bug_text = re.... | fim | ytdl-org/youtube-dl | python |
#!/usr/bin/env python
from __future__ import unicode_literals
import optparse
import os.path
import sys
from utils import read_file, read_version, write_file
def main():
parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
options, args = parser.parse_args()
if len(args) != 2:
parser.err... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>in bases:
if b not in classes and b not in ordered_cls:
if b.__name__ == 'GenericIE':
exit()
classes.insert(0, b)
stop = True
if stop:
break
if all(b in ordered_cls for b in bases):
orde... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>e
from youtube_dl.compat import compat_open as open
README_FILE = 'README.md'
helptext = sys.stdin.read()
if isinstance(helptext, bytes):
helptext = helptext.decode('utf-8')
oldreadme = read_file(README_FILE)
header = oldreadme[:oldreadme.index('# OPTIONS')]
footer = oldreadme[oldreadme.index('# C... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>s_md(ies))
write_file(outfile, out)
if __name__ == '__main__':
main()
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
import optparse
import os.path
import sys
# Import youtube_dl
dirn = os.path.dirname
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
im... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>(readme):
ret = ''
in_options = False
for line in readme.split('\n'):
if line.startswith('# '):
if line[2:].startswith('OPTIONS'):
in_options = True
else:
in_options = False
if in_options:
if line.lstrip().sta... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>tal downloads traffic: %s' % format_size(total_bytes))
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
import itertools
import json
import os
import re
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.compat import (
... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>put file'
parser.add_argument('outfile', **compat_kwargs(kwargs))
opts = parser.parse_args()
if has_infile:
return opts.infile, opts.outfile
return opts.outfile
def compose_functions(*functions):
return lambda x: functools.reduce(lambda y, f: f(y), functions, x)
def run_pr... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
import os
from os.path import dirname as dirn
import sys
sys.path.insert(0, dirn(dirn(<|fim_suffix|>
if opt._short_opts:
diropts.extend(opt._short_opts)
if opt._long_opts:
diropts.extend(opt._long_opts)... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>n info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
from youtube_dl.version import __version__
version = __version__
# The full version, including alpha/beta/rc tags.
re... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import os.path
import warnings
import sys
try:
from setuptools import setup, Command
setuptools_available = True
except ImportError:
from distutils.core import setup, Command
setuptool<|fim_suffix|>ommand):
... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import unicode_literals
import errno
import hashlib
import json
import os.path
import re
import ssl
import sys
import types
import unittest
import youtube_dl.extractor
from youtube_dl import YoutubeDL
from youtube_dl.compat import (
compat_open as open,
compat_os_name,
compat... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>,
"userInteractionCount": 1120958
}, "aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "88",
"ratingCount": "630",
"bestRating": "100",
"worstRating": "0"
}, "actor": [{
"@type": "Person",
"name": "Kleio Valentien",
"url": "https://www.eporner.com/pornstar/kleio-valentien/"
}]}
</script>''',... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>empl}
if na_placeholder != 'NA':
params['outtmpl_na_placeholder'] = na_placeholder
ydl = YoutubeDL(params)
return ydl.prepare_filename(info)
self.assertEqual(fname('%(id)s.%(ext)s'), '1234.mp4')
self.assertEqual(fname('%(id)s-%(width)s.%(... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>cookies.txt')
cookiejar.load(ignore_discard=True, ignore_expires=True)
cookies = cookiejar.get_cookies_for_url('https://www.foobar.foobar/')
self.assertEqual(len(cookies), 2)
cookies = cookiejar.get_cookies_for_url('https://foobar.foobar/')
self.assertFalse(cookies)... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
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_... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
# 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 try_rm
from youtube_dl import YoutubeDL
from youtube_dl.utils import Downl... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>e_name, ie_list) in name_accu.items():
self.assertEqual(
len(ie_list), 1,
'Multiple extractors with the same IE_NAME "%s" (%s)' % (ie_name, ', '.join(ie_list)))
if __name__ == '__main__':
unittest.main()
<|fim_prefix|>#!/usr/bin/env python
from __future__... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>.', obj)
self.assertEqual(c.load('test_cache', 'k2'), None)
self.assertFalse(_is_empty(self.test_dir))
self.assertEqual(c.load('test_cache', 'k.'), obj)
self.assertEqual(c.load('test_cache', 'y'), None)
self.assertEqual(c.load('test_cache2', 'k.'), None)
c.r... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>), 'abc=def')
self.assertEqual(compat_urllib_parse_urlencode([(b'abc', b'def')]), 'abc=def')
def test_compat_shlex_split(self):
self.assertEqual(compat_shlex_split('-option "one two"'), ['-option', 'one two'])
self.assertEqual(compat_shlex_split('-option "one\ntwo" \n -flag'),... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>name = 'test_%s_%d' % (test_case['name'], i)
i += 1
test_method = generator(test_case, tname)
test_method.__name__ = str(tname)
ie_list = test_case.get('add_ie')
test_method.add_ie = ie_list and ','.join(ie_list)
setattr(TestDownload, test_method.__name__, test_method)
del ... | fim | ytdl-org/youtube-dl | python |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import re
import sys
import subprocess
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import (
FakeLogger,
FakeYDL,
http_server... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|> try_rm(encodeFilename(filename))
def download_all(self, params):
for ep in ('regular', 'no-content-length', 'no-range', 'no-range-no-content-length'):
self.download(params, ep)
def test_regular(self):
self.download_all({})
def test_chunked(self):
s... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>= '.__main__'
def test_import(self):
subprocess.check_call([sys.executable, '-c', 'import youtube_dl'], cwd=rootDir)
def test_module_exec(self):
subprocess.check_call([sys.executable, '-m', self.module, '--version'], cwd=rootDir, stdout=_DEV_NULL)
def test_main_exec(self):
... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import contextlib
import gzip
import io
import ssl
import tempfile
import threading
... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>pass
def error(self, msg):
pass
class TestIqiyiSDKInterpreter(unittest.TestCase):
def test_iqiyi_sdk_interpreter(self):
'''
Test the functionality of IqiyiSDKInterpreter by trying to log in
If `sign` is incorrect, /validate call throws an HTTP 556 error
... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|> self._test('''
function f() { return [
undefined < undefined,
undefined > undefined,
undefined === 0,
undefined == 0,
undefined < 0,
undefined > 0,
undefined >= 0,
u... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>hasattr(ie, '_login'):
continue
self.assertTrue(
hasattr(ie, '_NETRC_MACHINE'),
'Extractor %s supports login, but is missing a _NETRC_MACHINE property' % ie.IE_NAME)
if __name__ == '__main__':
unittest.main()
<|fim_prefix|># coding: utf-8
f... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|> ['--username=PRIVATE'])
if __name__ == '__main__':
unittest.main()
<|fim_prefix|># coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.... | fim | ytdl-org/youtube-dl | python |
#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.postprocessor import MetadataFromTitlePP
class TestMetadataFromTitle(unittest.TestCase):
de... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>_str))
if __name__ == '__main__':
unittest.main()
<|fim_prefix|>#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import random
... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
# 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 FakeYDL, md5
from youtube_dl.extractor import (
YoutubeIE,
Dailymo... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
dirn = os.path.dirname
sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
import errno
import json
import re
import subprocess
from youtube_dl.swfinterp import SWFInterpr... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import itertools
import re
from youtube_dl.traversal import (
dict_get,
ge... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>Matches(
self,
code,
r'(?:(?:#.*?|\s*)\n)*from __future__ import (?:[a-z_]+,\s*)*unicode_literals',
'unicode_literals import missing in %s' % fn)
m = re.search(r'(?<=\s)u[\'"](?!\)|,|$)', code)
... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>3a71e9a11558558acea1840aec37fc396fb6b65dc81a1c4144e03bd1c011de62e3f1357b327d08426fe93, 65537)
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'versions.json'), 'rb') as f:
versions_info = f.read().decode()
versions_info = json.loads(versions_info)
sig... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>act_attributes('<e x=""">'), {'x': '"'})
self.assertEqual(extract_attributes('<e x="£">'), {'x': '£'}) # HTML 3.2
self.assertEqual(extract_attributes('<e x="λ">'), {'x': 'λ'}) # HTML 4.0
self.assertEqual(extract_attributes('<e x="&foo">'), {'x': '&foo'})
... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
# codi<|fim_suffix|>'johnsmith' not in serr)
self.assertTrue(b'-p' in serr)
self.assertTrue(b'secret' not in serr)
def test_private_info_eq(self):
outp = subprocess.Popen(
[
sys.executable, 'youtube_dl/__main__.py', '-v',
... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>.assertEqual(len(expected), 0, 'Not all expected annotations were found.')
def tearDown(self):
try_rm(ANNOTATIONS_FILE)
if __name__ == '__main__':
unittest.main()
<|fim_prefix|>#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# 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 FakeYDL
from youtube_dl.extractor import (
Yout... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>rtExtractId('https://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
assertExtractId('https://www.youtube.com/watch?feature=player_embedded&v=BaW_jenozKc', 'BaW_jenozKc')
assertExtractId('https://www.youtube.com/watch_popup?v=BaW_jenozKc', 'BaW_jenozKc')
assertExtractId('http... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>
'W9HJZKktxuYoDTqW', 'jHbbkcaxm54',
),
(
'https://www.youtube.com/s/player/f6e09c70/player_ias_tce.vflset/en_US/base.js',
'W9HJZKktxuYoDTqW', 'jHbbkcaxm54',
),
(
'https://www.youtube.com/s/player/e7567ecf/player_ias_tce.vflset/en_US/base.js',
'Sy4aDG... | fim | ytdl-org/youtube-dl | python |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
__license__ = 'Public Domain'
import io
import os
import random
import sys
from .options import (
parseOpts,
)
from .compat import (
compat_getpass,
compat_register_utf8,
compat_shlex_split,
_workaround_optparse_bug91... | fim | ytdl-org/youtube-dl | python |
#!/usr/bin/env python
from __future__ import unicode_literals
# Execute with
# $ python youtube_dl/__main__.py (2.6+)
# $ python -m youtube_dl (2.7+)
import sys
if __package__ is None and not hasattr(sys, 'frozen'):
# direct call of __main__.py
import os.path
path = os.path.realpath(os.path.absp... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import unicode_literals
from math import ceil
from .compat import compat_b64decode
from .utils import bytes_to_intlist, intlist_to_bytes
BLOCK_SIZE_BYTES = 16
def pkcs7_padding(data):
"""
PKCS#7 padding
@param {int[]} data cleartext
@returns {int[]} p... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>lf._write_debug('Loading {section}.{key} from cache'.format(section=section, key=key), only_once=True)
return self._validate(json.load(cachef), min_ver)
except (ValueError, KeyError):
try:
file_size = 'size: %d' % os.path.getsize(cache_fn)
ex... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|># coding: utf-8
from __future__ import unicode_literals
from .compat import (
compat_str,
compat_chr,
)
# 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
# In case newly foldable Unicode cha... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import unicode_literals
from ..utils import (
determine_protocol,
)
def get_suitable_downloader(info_dict, params={}):
info_dict['protocol'] = determine_protocol(info_dict)
info_copy = info_dict.copy()
return _get_suitable_downloader(info_copy, params)
# Some of these ... | fim | ytdl-org/youtube-dl | python |
from __future__ import division, unicode_literals
import os
import re
import sys
import time
import random
from ..compat import compat_os_name
from ..utils import (
decodeArgument,
encodeFilename,
error_to_compat_str,
float_or_none,
format_bytes,
shell_quote,
timeconvert,
)
class FileDow... | fim | ytdl-org/youtube-dl | python |
<|fim_suffix|>x)
continue
self.report_error('giving up after %s fragment retries' % count)
return False
self._finish_frag_download(ctx)
return True
<|fim_prefix|>from __future__ import unicode_literals
import itertools
from .fragment import Fragmen... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import unicode_literals
import os
import re
import subprocess
import sys
import tempfile
import time
from .common import FileDownloader
from ..compat import (
compat_setenv,
compat_str,
compat_subprocess_Popen,
)
try:
from ..postprocessor.ffmpeg import FFmpegPostProcesso... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import division, unicode_literals
import io
import itertools
import time
from .fragment import FragmentFD
from ..compat import (
compat_b64decode,
compat_etree_fromstring,
compat_urlparse,
compat_urllib_error,
compat_urllib_parse_urlparse,
compat_struct_pack,
... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import division, unicode_literals
import os
import time
import json
from .common import FileDownloader
from .http import HttpFD
from ..utils import (
error_to_compat_str,
encodeFilename,
sanitize_open,
sanitized_Request,
)
class HttpQuietDownloader(HttpFD):
def to_s... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import unicode_literals
import re
import binascii
try:
from Crypto.Cipher import AES
can_decrypt_frag = True
except ImportError:
can_decrypt_frag = False
from .fragment import FragmentFD
from .external import FFmpegFD
from ..compat import (
compat_urllib_error,
compa... | fim | ytdl-org/youtube-dl | python |
<|fim_prefix|>from __future__ import unicode_literals
import errno
import os
import socket
import time
import random
import re
from .common import FileDownloader
from ..compat import (
compat_str,
compat_urllib_error,
)
from ..utils import (
ContentTooShortError,
encodeFilename,
int_or_none,
s... | fim | ytdl-org/youtube-dl | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.