aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/extractor/acfun.py2
-rw-r--r--yt_dlp/extractor/bilibili.py2
-rw-r--r--yt_dlp/extractor/common.py3
-rw-r--r--yt_dlp/extractor/manyvids.py2
-rw-r--r--yt_dlp/extractor/neteasemusic.py4
-rw-r--r--yt_dlp/extractor/yandexvideo.py4
-rw-r--r--yt_dlp/options.py9
-rw-r--r--yt_dlp/utils.py1
8 files changed, 15 insertions, 12 deletions
diff --git a/yt_dlp/extractor/acfun.py b/yt_dlp/extractor/acfun.py
index 92b905fa7..9ec259a75 100644
--- a/yt_dlp/extractor/acfun.py
+++ b/yt_dlp/extractor/acfun.py
@@ -161,7 +161,7 @@ class AcFunBangumiIE(AcFunVideoBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
ac_idx = parse_qs(url).get('ac', [None])[-1]
- video_id = f'{video_id}{format_field(ac_idx, template="__%s")}'
+ video_id = f'{video_id}{format_field(ac_idx, None, "__%s")}'
webpage = self._download_webpage(url, video_id)
json_bangumi_data = self._search_json(r'window.bangumiData\s*=', webpage, 'bangumiData', video_id)
diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py
index a237343c6..de28aa4b7 100644
--- a/yt_dlp/extractor/bilibili.py
+++ b/yt_dlp/extractor/bilibili.py
@@ -368,7 +368,7 @@ class BiliBiliBangumiIE(BilibiliBaseIE):
or '正在观看预览,大会员免费看全片' in webpage):
self.raise_login_required('This video is for premium members only')
- play_info = self._search_json(r'window\.__playinfo__\s*=\s*', webpage, 'play info', video_id)['data']
+ play_info = self._search_json(r'window\.__playinfo__\s*=', webpage, 'play info', video_id)['data']
formats = self.extract_formats(play_info)
if (not formats and '成为大会员抢先看' in webpage
and play_info.get('durl') and not play_info.get('dash')):
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 84a2b95af..20ed52216 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -3725,7 +3725,8 @@ class InfoExtractor:
if not cls.working():
desc += ' (**Currently broken**)' if markdown else ' (Currently broken)'
- name = f' - **{cls.IE_NAME}**' if markdown else cls.IE_NAME
+ # Escape emojis. Ref: https://github.com/github/markup/issues/1153
+ name = (' - **%s**' % re.sub(r':(\w+:)', ':\u200B\\g<1>', cls.IE_NAME)) if markdown else cls.IE_NAME
return f'{name}:{desc}' if desc else name
def extract_subtitles(self, *args, **kwargs):
diff --git a/yt_dlp/extractor/manyvids.py b/yt_dlp/extractor/manyvids.py
index c713805c5..63ff5f054 100644
--- a/yt_dlp/extractor/manyvids.py
+++ b/yt_dlp/extractor/manyvids.py
@@ -68,7 +68,7 @@ class ManyVidsIE(InfoExtractor):
)
def txt_or_none(s, default=None):
- return (s.strip() or default) if isinstance(s, compat_str) else default
+ return (s.strip() or default) if isinstance(s, str) else default
uploader = txt_or_none(info.get('data-meta-author'))
diff --git a/yt_dlp/extractor/neteasemusic.py b/yt_dlp/extractor/neteasemusic.py
index 44fa60ce9..5cf96ad7e 100644
--- a/yt_dlp/extractor/neteasemusic.py
+++ b/yt_dlp/extractor/neteasemusic.py
@@ -1,3 +1,4 @@
+import itertools
import json
import re
import time
@@ -39,8 +40,7 @@ class NetEaseMusicBaseIE(InfoExtractor):
result = b64encode(m.digest()).decode('ascii')
return result.replace('/', '_').replace('+', '-')
- @classmethod
- def make_player_api_request_data_and_headers(cls, song_id, bitrate):
+ def make_player_api_request_data_and_headers(self, song_id, bitrate):
KEY = b'e82ckenh8dichen8'
URL = '/api/song/enhance/player/url'
now = int(time.time() * 1000)
diff --git a/yt_dlp/extractor/yandexvideo.py b/yt_dlp/extractor/yandexvideo.py
index 7932edf33..5e6cf6edd 100644
--- a/yt_dlp/extractor/yandexvideo.py
+++ b/yt_dlp/extractor/yandexvideo.py
@@ -255,7 +255,7 @@ class ZenYandexIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- redirect = self._search_json(r'var it\s*=\s*', webpage, 'redirect', id, default={}).get('retpath')
+ redirect = self._search_json(r'var it\s*=', webpage, 'redirect', id, default={}).get('retpath')
if redirect:
video_id = self._match_id(redirect)
webpage = self._download_webpage(redirect, video_id, note='Redirecting')
@@ -373,7 +373,7 @@ class ZenYandexChannelIE(InfoExtractor):
item_id = self._match_id(url)
webpage = self._download_webpage(url, item_id)
redirect = self._search_json(
- r'var it\s*=\s*', webpage, 'redirect', item_id, default={}).get('retpath')
+ r'var it\s*=', webpage, 'redirect', item_id, default={}).get('retpath')
if redirect:
item_id = self._match_id(redirect)
webpage = self._download_webpage(redirect, item_id, note='Redirecting')
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index d3dfee820..bee867aa9 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -294,9 +294,10 @@ def create_parser():
aliases = (x if x.startswith('-') else f'--{x}' for x in map(str.strip, aliases.split(',')))
try:
+ args = [f'ARG{i}' for i in range(nargs)]
alias_group.add_option(
- *aliases, help=opts, nargs=nargs, dest=parser.ALIAS_DEST, type='str' if nargs else None,
- metavar=' '.join(f'ARG{i}' for i in range(nargs)), action='callback',
+ *aliases, nargs=nargs, dest=parser.ALIAS_DEST, type='str' if nargs else None,
+ metavar=' '.join(args), help=opts.format(*args), action='callback',
callback=_alias_callback, callback_kwargs={'opts': opts, 'nargs': nargs})
except Exception as err:
raise optparse.OptionValueError(f'wrong {opt_str} formatting; {err}')
@@ -549,11 +550,11 @@ def create_parser():
selection.add_option(
'--min-filesize',
metavar='SIZE', dest='min_filesize', default=None,
- help='Do not download any videos smaller than SIZE, e.g. 50k or 44.6M')
+ help='Abort download if filesize is smaller than SIZE, e.g. 50k or 44.6M')
selection.add_option(
'--max-filesize',
metavar='SIZE', dest='max_filesize', default=None,
- help='Do not download any videos larger than SIZE, e.g. 50k or 44.6M')
+ help='Abort download if filesize if larger than SIZE, e.g. 50k or 44.6M')
selection.add_option(
'--date',
metavar='DATE', dest='date', default=None,
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 4d1247eea..d0513496e 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -480,6 +480,7 @@ class HTMLBreakOnClosingTagParser(html.parser.HTMLParser):
raise self.HTMLBreakOnClosingTagException()
+# XXX: This should be far less strict
def get_element_text_and_html_by_tag(tag, html):
"""
For the first element with the specified tag in the passed HTML document