Skip to content

Commit

Permalink
yt_dlp: 5945fc1945a4001537072e39f03725f944437834
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 27, 2024
1 parent 6948c92 commit da32143
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 29 deletions.
4 changes: 2 additions & 2 deletions lib/yt_dlp/downloader/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def _call_downloader(self, tmpfilename, info_dict):
env = None
proxy = self.params.get('proxy')
if proxy:
if not re.match(r'^[\da-zA-Z]+://', proxy):
if not re.match(r'[\da-zA-Z]+://', proxy):
proxy = f'http://{proxy}'

if proxy.startswith('socks'):
Expand Down Expand Up @@ -559,7 +559,7 @@ def _call_downloader(self, tmpfilename, info_dict):

selected_formats = info_dict.get('requested_formats') or [info_dict]
for i, fmt in enumerate(selected_formats):
is_http = re.match(r'^https?://', fmt['url'])
is_http = re.match(r'https?://', fmt['url'])
cookies = self.ydl.cookiejar.get_cookies_for_url(fmt['url']) if is_http else []
if cookies:
args.extend(['-cookies', ''.join(
Expand Down
8 changes: 4 additions & 4 deletions lib/yt_dlp/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ def _parse_m3u8_formats_and_subtitles(
has_drm = HlsFD._has_drm(m3u8_doc)

def format_url(url):
return url if re.match(r'^https?://', url) else urllib.parse.urljoin(m3u8_url, url)
return url if re.match(r'https?://', url) else urllib.parse.urljoin(m3u8_url, url)

if self.get_param('hls_split_discontinuity', False):
def _extract_m3u8_playlist_indices(manifest_url=None, m3u8_doc=None):
Expand Down Expand Up @@ -2812,11 +2812,11 @@ def extract_Initialization(source):
base_url_e = element.find(_add_ns('BaseURL'))
if try_call(lambda: base_url_e.text) is not None:
base_url = base_url_e.text + base_url
if re.match(r'^https?://', base_url):
if re.match(r'https?://', base_url):
break
if mpd_base_url and base_url.startswith('/'):
base_url = urllib.parse.urljoin(mpd_base_url, base_url)
elif mpd_base_url and not re.match(r'^https?://', base_url):
elif mpd_base_url and not re.match(r'https?://', base_url):
if not mpd_base_url.endswith('/'):
mpd_base_url += '/'
base_url = mpd_base_url + base_url
Expand Down Expand Up @@ -2906,7 +2906,7 @@ def prepare_template(template_name, identifiers):
}

def location_key(location):
return 'url' if re.match(r'^https?://', location) else 'path'
return 'url' if re.match(r'https?://', location) else 'path'

if 'segment_urls' not in representation_ms_info and 'media' in representation_ms_info:

Expand Down
4 changes: 2 additions & 2 deletions lib/yt_dlp/extractor/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ def _real_extract(self, url):
default_search = 'fixup_error'

if default_search in ('auto', 'auto_warning', 'fixup_error'):
if re.match(r'^[^\s/]+\.[^\s/]+/', url):
if re.match(r'[^\s/]+\.[^\s/]+/', url):
self.report_warning('The url doesn\'t specify the protocol, trying with http')
return self.url_result('http://' + url)
elif default_search != 'fixup_error':
Expand Down Expand Up @@ -2400,7 +2400,7 @@ def _real_extract(self, url):

# Check for direct link to a video
content_type = full_response.headers.get('Content-Type', '').lower()
m = re.match(r'^(?P<type>audio|video|application(?=/(?:ogg$|(?:vnd\.apple\.|x-)?mpegurl)))/(?P<format_id>[^;\s]+)', content_type)
m = re.match(r'(?P<type>audio|video|application(?=/(?:ogg$|(?:vnd\.apple\.|x-)?mpegurl)))/(?P<format_id>[^;\s]+)', content_type)
if m:
self.report_detected('direct video link')
headers = filter_dict({'Referer': smuggled_data.get('referer')})
Expand Down
4 changes: 2 additions & 2 deletions lib/yt_dlp/networking/_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import websockets.version

websockets_version = tuple(map(int_or_none, websockets.version.version.split('.')))
if websockets_version < (12, 0):
raise ImportError('Only websockets>=12.0 is supported')
if websockets_version < (13, 0):
raise ImportError('Only websockets>=13.0 is supported')

import websockets.sync.client
from websockets.uri import parse_uri
Expand Down
10 changes: 5 additions & 5 deletions lib/yt_dlp/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,16 +647,16 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
'You can also simply specify a field to match if the field is present, '
'use "!field" to check if the field is not present, and "&" to check multiple conditions. '
'Use a "\\" to escape "&" or quotes if needed. If used multiple times, '
'the filter matches if at least one of the conditions is met. E.g. --match-filter '
'!is_live --match-filter "like_count>?100 & description~=\'(?i)\\bcats \\& dogs\\b\'" '
'the filter matches if at least one of the conditions is met. E.g. --match-filters '
'!is_live --match-filters "like_count>?100 & description~=\'(?i)\\bcats \\& dogs\\b\'" '
'matches only videos that are not live OR those that have a like count more than 100 '
'(or the like field is not available) and also has a description '
'that contains the phrase "cats & dogs" (caseless). '
'Use "--match-filter -" to interactively ask whether to download each video'))
'Use "--match-filters -" to interactively ask whether to download each video'))
selection.add_option(
'--no-match-filters',
dest='match_filter', action='store_const', const=None,
help='Do not use any --match-filter (default)')
help='Do not use any --match-filters (default)')
selection.add_option(
'--break-match-filters',
metavar='FILTER', dest='breaking_match_filter', action='append',
Expand Down Expand Up @@ -704,7 +704,7 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
selection.add_option(
'--break-per-input',
action='store_true', dest='break_per_url', default=False,
help='Alters --max-downloads, --break-on-existing, --break-match-filter, and autonumber to reset per input URL')
help='Alters --max-downloads, --break-on-existing, --break-match-filters, and autonumber to reset per input URL')
selection.add_option(
'--no-break-per-input',
action='store_false', dest='break_per_url',
Expand Down
2 changes: 1 addition & 1 deletion lib/yt_dlp/postprocessor/sponsorblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SponsorBlockPP(FFmpegPostProcessor):
def __init__(self, downloader, categories=None, api='https://sponsor.ajay.app'):
FFmpegPostProcessor.__init__(self, downloader)
self._categories = tuple(categories or self.CATEGORIES.keys())
self._API_URL = api if re.match('^https?://', api) else 'https://' + api
self._API_URL = api if re.match('https?://', api) else 'https://' + api

def run(self, info):
extractor = info['extractor_key']
Expand Down
36 changes: 29 additions & 7 deletions lib/yt_dlp/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,42 @@ def _get_binary_name():


def _get_system_deprecation():
MIN_SUPPORTED, MIN_RECOMMENDED = (3, 8), (3, 8)
MIN_SUPPORTED, MIN_RECOMMENDED = (3, 8), (3, 9)

if sys.version_info > MIN_RECOMMENDED:
return None

major, minor = sys.version_info[:2]
PYTHON_MSG = f'Please update to Python {".".join(map(str, MIN_RECOMMENDED))} or above'

if sys.version_info < MIN_SUPPORTED:
msg = f'Python version {major}.{minor} is no longer supported'
else:
msg = (f'Support for Python version {major}.{minor} has been deprecated. '
'\nYou may stop receiving updates on this version at any time')
return f'Python version {major}.{minor} is no longer supported! {PYTHON_MSG}'

EXE_MSG_TMPL = ('Support for {} has been deprecated. '
'See https://github.com/yt-dlp/yt-dlp/{} for details.\n{}')
STOP_MSG = 'You may stop receiving updates on this version at any time!'
variant = detect_variant()

# Temporary until Windows builds use 3.9, which will drop support for Win7 and 2008ServerR2
if variant in ('win_exe', 'win_x86_exe', 'py2exe'):
platform_name = platform.platform()
if any(platform_name.startswith(f'Windows-{name}') for name in ('7', '2008ServerR2')):
return EXE_MSG_TMPL.format('Windows 7/Server 2008 R2', 'issues/10086', STOP_MSG)
elif variant == 'py2exe':
return EXE_MSG_TMPL.format(
'py2exe builds (yt-dlp_min.exe)', 'issues/10087',
'In a future update you will be migrated to the PyInstaller-bundled executable. '
'This will be done automatically; no action is required on your part')
return None

# Temporary until aarch64/armv7l build flow is bumped to Ubuntu 20.04 and Python 3.9
elif variant in ('linux_aarch64_exe', 'linux_armv7l_exe'):
libc_ver = version_tuple(os.confstr('CS_GNU_LIBC_VERSION').partition(' ')[2])
if libc_ver < (2, 31):
return EXE_MSG_TMPL.format('system glibc version < 2.31', 'pull/8638', STOP_MSG)
return None

major, minor = MIN_RECOMMENDED
return f'{msg}! Please update to Python {major}.{minor} or above'
return f'Support for Python version {major}.{minor} has been deprecated. {PYTHON_MSG}'


def _sha256_file(path):
Expand Down
6 changes: 3 additions & 3 deletions lib/yt_dlp/utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ def urljoin(base, path):
path = path.decode()
if not isinstance(path, str) or not path:
return None
if re.match(r'^(?:[a-zA-Z][a-zA-Z0-9+-.]*:)?//', path):
if re.match(r'(?:[a-zA-Z][a-zA-Z0-9+-.]*:)?//', path):
return path
if isinstance(base, bytes):
base = base.decode()
Expand Down Expand Up @@ -2007,7 +2007,7 @@ def url_or_none(url):
if not url or not isinstance(url, str):
return None
url = url.strip()
return url if re.match(r'^(?:(?:https?|rt(?:m(?:pt?[es]?|fp)|sp[su]?)|mms|ftps?):)?//', url) else None
return url if re.match(r'(?:(?:https?|rt(?:m(?:pt?[es]?|fp)|sp[su]?)|mms|ftps?):)?//', url) else None


def strftime_or_none(timestamp, date_format='%Y%m%d', default=None):
Expand Down Expand Up @@ -3113,7 +3113,7 @@ def is_html(first_bytes):
while first_bytes.startswith(bom):
encoding, first_bytes = enc, first_bytes[len(bom):]

return re.match(r'^\s*<', first_bytes.decode(encoding, 'replace'))
return re.match(r'\s*<', first_bytes.decode(encoding, 'replace'))


def determine_protocol(info_dict):
Expand Down
6 changes: 3 additions & 3 deletions lib/yt_dlp/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Autogenerated by devscripts/update-version.py

__version__ = '2024.08.06'
__version__ = '2024.09.27'

RELEASE_GIT_HEAD = '4d9231208332d4c32364b8cd814bff8b20232cae'
RELEASE_GIT_HEAD = 'c6387abc1af9842bb0541288a5610abba9b1ab51'

VARIANT = None

Expand All @@ -12,4 +12,4 @@

ORIGIN = 'yt-dlp/yt-dlp'

_pkg_version = '2024.08.06'
_pkg_version = '2024.09.27'

0 comments on commit da32143

Please sign in to comment.