mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-24 16:21:24 +01:00
Compare commits
No commits in common. "f660e2f461660ac8ab5cb20ad43d70ab2755fe7f" and "a09f52f93d363891b8ce947a7b79dcc96b1e4b12" have entirely different histories.
f660e2f461
...
a09f52f93d
|
@ -9,7 +9,11 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from devscripts.utils import get_filename_args, read_file, write_file
|
from devscripts.utils import (
|
||||||
|
get_filename_args,
|
||||||
|
read_file,
|
||||||
|
write_file,
|
||||||
|
)
|
||||||
|
|
||||||
VERBOSE_TMPL = '''
|
VERBOSE_TMPL = '''
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
|
|
|
@ -9,7 +9,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
|
||||||
from test.helper import FakeYDL, report_warning
|
from test.helper import FakeYDL, report_warning
|
||||||
from yt_dlp.update import UpdateInfo, Updater
|
from yt_dlp.update import Updater, UpdateInfo
|
||||||
|
|
||||||
TEST_API_DATA = {
|
TEST_API_DATA = {
|
||||||
'yt-dlp/yt-dlp/latest': {
|
'yt-dlp/yt-dlp/latest': {
|
||||||
|
|
|
@ -60,13 +60,7 @@ from .postprocessor import (
|
||||||
get_postprocessor,
|
get_postprocessor,
|
||||||
)
|
)
|
||||||
from .postprocessor.ffmpeg import resolve_mapping as resolve_recode_mapping
|
from .postprocessor.ffmpeg import resolve_mapping as resolve_recode_mapping
|
||||||
from .update import (
|
from .update import REPOSITORY, _get_system_deprecation, _make_label, current_git_head, detect_variant
|
||||||
REPOSITORY,
|
|
||||||
_get_system_deprecation,
|
|
||||||
_make_label,
|
|
||||||
current_git_head,
|
|
||||||
detect_variant,
|
|
||||||
)
|
|
||||||
from .utils import (
|
from .utils import (
|
||||||
DEFAULT_OUTTMPL,
|
DEFAULT_OUTTMPL,
|
||||||
IDENTITY,
|
IDENTITY,
|
||||||
|
|
|
@ -35,8 +35,8 @@ from ..utils import (
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
url_or_none,
|
|
||||||
urlhandle_detect_ext,
|
urlhandle_detect_ext,
|
||||||
|
url_or_none,
|
||||||
urljoin,
|
urljoin,
|
||||||
variadic,
|
variadic,
|
||||||
xpath_attr,
|
xpath_attr,
|
||||||
|
|
|
@ -5298,7 +5298,6 @@ class YoutubeTabBaseInfoExtractor(YoutubeBaseInfoExtractor):
|
||||||
# See: https://github.com/yt-dlp/yt-dlp/issues/116
|
# See: https://github.com/yt-dlp/yt-dlp/issues/116
|
||||||
if not traverse_obj(data, 'contents', 'currentVideoEndpoint', 'onResponseReceivedActions'):
|
if not traverse_obj(data, 'contents', 'currentVideoEndpoint', 'onResponseReceivedActions'):
|
||||||
retry.error = ExtractorError('Incomplete yt initial data received')
|
retry.error = ExtractorError('Incomplete yt initial data received')
|
||||||
data = None
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return webpage, data
|
return webpage, data
|
||||||
|
|
|
@ -28,3 +28,4 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
warnings.warn(f'Failed to import "websockets" request handler: {e}' + bug_reports_message())
|
warnings.warn(f'Failed to import "websockets" request handler: {e}' + bug_reports_message())
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ def _socket_connect(ip_addr, timeout, source_address):
|
||||||
sock.bind(source_address)
|
sock.bind(source_address)
|
||||||
sock.connect(sa)
|
sock.connect(sa)
|
||||||
return sock
|
return sock
|
||||||
except OSError:
|
except socket.error:
|
||||||
sock.close()
|
sock.close()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ def create_socks_proxy_socket(dest_addr, proxy_args, proxy_ip_addr, timeout, sou
|
||||||
sock.bind(source_address)
|
sock.bind(source_address)
|
||||||
sock.connect(dest_addr)
|
sock.connect(dest_addr)
|
||||||
return sock
|
return sock
|
||||||
except OSError:
|
except socket.error:
|
||||||
sock.close()
|
sock.close()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ def create_connection(
|
||||||
host, port = address
|
host, port = address
|
||||||
ip_addrs = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
|
ip_addrs = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
|
||||||
if not ip_addrs:
|
if not ip_addrs:
|
||||||
raise OSError('getaddrinfo returns an empty list')
|
raise socket.error('getaddrinfo returns an empty list')
|
||||||
if source_address is not None:
|
if source_address is not None:
|
||||||
af = socket.AF_INET if ':' not in source_address[0] else socket.AF_INET6
|
af = socket.AF_INET if ':' not in source_address[0] else socket.AF_INET6
|
||||||
ip_addrs = [addr for addr in ip_addrs if addr[0] == af]
|
ip_addrs = [addr for addr in ip_addrs if addr[0] == af]
|
||||||
|
@ -272,7 +272,7 @@ def create_connection(
|
||||||
# https://bugs.python.org/issue36820
|
# https://bugs.python.org/issue36820
|
||||||
err = None
|
err = None
|
||||||
return sock
|
return sock
|
||||||
except OSError as e:
|
except socket.error as e:
|
||||||
err = e
|
err = e
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -188,7 +188,6 @@ class RequestsSession(requests.sessions.Session):
|
||||||
"""
|
"""
|
||||||
Ensure unified redirect method handling with our urllib redirect handler.
|
Ensure unified redirect method handling with our urllib redirect handler.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rebuild_method(self, prepared_request, response):
|
def rebuild_method(self, prepared_request, response):
|
||||||
new_method = get_redirect_method(prepared_request.method, response.status_code)
|
new_method = get_redirect_method(prepared_request.method, response.status_code)
|
||||||
|
|
||||||
|
@ -219,7 +218,6 @@ class Urllib3LoggingFilter(logging.Filter):
|
||||||
|
|
||||||
class Urllib3LoggingHandler(logging.Handler):
|
class Urllib3LoggingHandler(logging.Handler):
|
||||||
"""Redirect urllib3 logs to our logger"""
|
"""Redirect urllib3 logs to our logger"""
|
||||||
|
|
||||||
def __init__(self, logger, *args, **kwargs):
|
def __init__(self, logger, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
|
@ -369,7 +367,7 @@ class SocksHTTPConnection(urllib3.connection.HTTPConnection):
|
||||||
self, f'Connection to {self.host} timed out. (connect timeout={self.timeout})') from e
|
self, f'Connection to {self.host} timed out. (connect timeout={self.timeout})') from e
|
||||||
except SocksProxyError as e:
|
except SocksProxyError as e:
|
||||||
raise urllib3.exceptions.ProxyError(str(e), e) from e
|
raise urllib3.exceptions.ProxyError(str(e), e) from e
|
||||||
except OSError as e:
|
except (OSError, socket.error) as e:
|
||||||
raise urllib3.exceptions.NewConnectionError(
|
raise urllib3.exceptions.NewConnectionError(
|
||||||
self, f'Failed to establish a new connection: {e}') from e
|
self, f'Failed to establish a new connection: {e}') from e
|
||||||
|
|
||||||
|
|
|
@ -5,26 +5,20 @@ import logging
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from ._helper import (
|
from ._helper import create_connection, select_proxy, make_socks_proxy_opts, create_socks_proxy_socket
|
||||||
create_connection,
|
from .common import Response, register_rh, Features
|
||||||
create_socks_proxy_socket,
|
|
||||||
make_socks_proxy_opts,
|
|
||||||
select_proxy,
|
|
||||||
)
|
|
||||||
from .common import Features, Response, register_rh
|
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
CertificateVerifyError,
|
CertificateVerifyError,
|
||||||
HTTPError,
|
HTTPError,
|
||||||
ProxyError,
|
|
||||||
RequestError,
|
RequestError,
|
||||||
SSLError,
|
SSLError,
|
||||||
TransportError,
|
TransportError, ProxyError,
|
||||||
)
|
)
|
||||||
from .websocket import WebSocketRequestHandler, WebSocketResponse
|
from .websocket import WebSocketRequestHandler, WebSocketResponse
|
||||||
from ..compat import functools
|
from ..compat import functools
|
||||||
from ..dependencies import websockets
|
from ..dependencies import websockets
|
||||||
from ..socks import ProxyError as SocksProxyError
|
|
||||||
from ..utils import int_or_none
|
from ..utils import int_or_none
|
||||||
|
from ..socks import ProxyError as SocksProxyError
|
||||||
|
|
||||||
if not websockets:
|
if not websockets:
|
||||||
raise ImportError('websockets is not installed')
|
raise ImportError('websockets is not installed')
|
||||||
|
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from .common import RequestHandler, Response
|
from .common import Response, RequestHandler
|
||||||
|
|
||||||
|
|
||||||
class WebSocketResponse(Response):
|
class WebSocketResponse(Response):
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Socks5AddressType:
|
||||||
ATYP_IPV6 = 0x04
|
ATYP_IPV6 = 0x04
|
||||||
|
|
||||||
|
|
||||||
class ProxyError(OSError):
|
class ProxyError(socket.error):
|
||||||
ERR_SUCCESS = 0x00
|
ERR_SUCCESS = 0x00
|
||||||
|
|
||||||
def __init__(self, code=None, msg=None):
|
def __init__(self, code=None, msg=None):
|
||||||
|
|
|
@ -1885,7 +1885,6 @@ def setproctitle(title):
|
||||||
buf = ctypes.create_string_buffer(len(title_bytes))
|
buf = ctypes.create_string_buffer(len(title_bytes))
|
||||||
buf.value = title_bytes
|
buf.value = title_bytes
|
||||||
try:
|
try:
|
||||||
# PR_SET_NAME = 15 Ref: /usr/include/linux/prctl.h
|
|
||||||
libc.prctl(15, buf, 0, 0, 0)
|
libc.prctl(15, buf, 0, 0, 0)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return # Strange libc, just skip this
|
return # Strange libc, just skip this
|
||||||
|
|
Loading…
Reference in New Issue
Block a user