mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 01:02:13 +01:00
[cleanup] Fix misc bugs (#8968)
Closes #8816 Authored by: bashonly, seproDev, pukkandan, Grub4k
This commit is contained in:
parent
47ab66db0f
commit
93240fc184
13 changed files with 20 additions and 16 deletions
|
@ -53,7 +53,7 @@ def __init__(self, ie: 'AbemaTVIE'):
|
|||
# the protocol that this should really handle is 'abematv-license://'
|
||||
# abematv_license_open is just a placeholder for development purposes
|
||||
# ref. https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Lib/urllib/request.py#L510
|
||||
setattr(self, 'abematv-license_open', getattr(self, 'abematv_license_open'))
|
||||
setattr(self, 'abematv-license_open', getattr(self, 'abematv_license_open', None))
|
||||
self.ie = ie
|
||||
|
||||
def _get_videokey_from_ticket(self, ticket):
|
||||
|
|
|
@ -107,7 +107,6 @@ def _real_extract(self, url):
|
|||
title
|
||||
tvRating
|
||||
}''' % episode_path
|
||||
['getVideoBySlug']
|
||||
else:
|
||||
query = query % '''metaDescription
|
||||
title
|
||||
|
|
|
@ -67,7 +67,7 @@ def _real_extract(self, url):
|
|||
webpage = self._download_webpage(url, video_id)
|
||||
info = self._download_and_extract_api_data(video_id, netloc)
|
||||
info['description'] = self._og_search_description(webpage, default=None)
|
||||
info['_old_archive_ids'] = [make_archive_id('Ant1NewsGrWatch', video_id)],
|
||||
info['_old_archive_ids'] = [make_archive_id('Ant1NewsGrWatch', video_id)]
|
||||
return info
|
||||
|
||||
|
||||
|
|
|
@ -1965,6 +1965,7 @@ class BiliIntlIE(BiliIntlBaseIE):
|
|||
'only_matching': True,
|
||||
}]
|
||||
|
||||
@staticmethod
|
||||
def _make_url(video_id, series_id=None):
|
||||
if series_id:
|
||||
return f'https://www.bilibili.tv/en/play/{series_id}/{video_id}'
|
||||
|
|
|
@ -747,7 +747,7 @@ def extract(self, url):
|
|||
raise
|
||||
except ExtractorError as e:
|
||||
e.video_id = e.video_id or self.get_temp_id(url)
|
||||
e.ie = e.ie or self.IE_NAME,
|
||||
e.ie = e.ie or self.IE_NAME
|
||||
e.traceback = e.traceback or sys.exc_info()[2]
|
||||
raise
|
||||
except IncompleteRead as e:
|
||||
|
@ -1339,7 +1339,10 @@ def _get_netrc_login_info(self, netrc_machine=None):
|
|||
else:
|
||||
return None, None
|
||||
if not info:
|
||||
raise netrc.NetrcParseError(f'No authenticators for {netrc_machine}')
|
||||
self.to_screen(f'No authenticators for {netrc_machine}')
|
||||
return None, None
|
||||
|
||||
self.write_debug(f'Using netrc for {netrc_machine} authentication')
|
||||
return info[0], info[2]
|
||||
|
||||
def _get_login_info(self, username_option='username', password_option='password', netrc_machine=None):
|
||||
|
|
|
@ -88,7 +88,7 @@ def _parse_post(self, post_data):
|
|||
'uploader_id': user_data.get('username'),
|
||||
'uploader_url': format_field(user_data, 'url', 'https://gamejolt.com%s'),
|
||||
'categories': [try_get(category, lambda x: '%s - %s' % (x['community']['name'], x['channel'].get('display_title') or x['channel']['title']))
|
||||
for category in post_data.get('communities' or [])],
|
||||
for category in post_data.get('communities') or []],
|
||||
'tags': traverse_obj(
|
||||
lead_content, ('content', ..., 'content', ..., 'marks', ..., 'attrs', 'tag'), expected_type=str_or_none),
|
||||
'like_count': int_or_none(post_data.get('like_count')),
|
||||
|
|
|
@ -21,7 +21,7 @@ def _real_extract(self, url):
|
|||
continue
|
||||
container = fmt.get('container')
|
||||
if container == 'hls':
|
||||
formats.extend(fmt_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
|
||||
formats.extend(self._extract_m3u8_formats(fmt_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
|
||||
else:
|
||||
fmt_profile = fmt.get('profile') or {}
|
||||
formats.append({
|
||||
|
|
|
@ -64,7 +64,7 @@ def _real_extract(self, url):
|
|||
# translate any ka month to an en one
|
||||
re.sub('|'.join(self._MONTH_NAMES_KA),
|
||||
lambda m: MONTH_NAMES['en'][self._MONTH_NAMES_KA.index(m.group(0))],
|
||||
upload_date, re.I))
|
||||
upload_date, flags=re.I))
|
||||
if upload_date else None)
|
||||
|
||||
return {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
class MyVidsterIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?myvidster\.com/video/(?P<id>\d+)/'
|
||||
_VALID_URL = r'https?://(?:www\.)?myvidster\.com/video/(?P<id>\d+)'
|
||||
|
||||
_TEST = {
|
||||
'url': 'http://www.myvidster.com/video/32059805/Hot_chemistry_with_raw_love_making',
|
||||
|
|
|
@ -38,14 +38,14 @@ def _real_extract(self, url):
|
|||
title = video['title']
|
||||
|
||||
formats = []
|
||||
for video in video['files_processed']['video/mp4']:
|
||||
if not video.get('src'):
|
||||
for v in video['files_processed']['video/mp4']:
|
||||
if not v.get('src'):
|
||||
continue
|
||||
resolution = video.get('resolution')
|
||||
resolution = v.get('resolution')
|
||||
height = int_or_none(self._search_regex(
|
||||
r'^(\d+)[pP]$', resolution or '', 'height', default=None))
|
||||
formats.append({
|
||||
'url': self._proto_relative_url(video['src']),
|
||||
'url': self._proto_relative_url(v['src']),
|
||||
'format_id': resolution,
|
||||
'height': height,
|
||||
})
|
||||
|
|
|
@ -386,7 +386,7 @@ def _extract_custom_m3u8_info(self, m3u8_data):
|
|||
if not line.startswith('#EXT-SL-'):
|
||||
continue
|
||||
tag, _, value = line.partition(':')
|
||||
key = lookup.get(tag.lstrip('#EXT-SL-'))
|
||||
key = lookup.get(tag[8:])
|
||||
if not key:
|
||||
continue
|
||||
m3u8_dict[key] = value
|
||||
|
|
|
@ -116,7 +116,7 @@ def subn(self, repl, string, *args, **kwargs):
|
|||
"""
|
||||
|
||||
if urllib3_version < (2, 0, 0):
|
||||
with contextlib.suppress():
|
||||
with contextlib.suppress(Exception):
|
||||
urllib3.util.IS_SECURETRANSPORT = urllib3.util.ssl_.IS_SECURETRANSPORT = True
|
||||
|
||||
|
||||
|
|
|
@ -1424,7 +1424,8 @@ def write_string(s, out=None, encoding=None):
|
|||
s = re.sub(r'([\r\n]+)', r' \1', s)
|
||||
|
||||
enc, buffer = None, out
|
||||
if 'b' in getattr(out, 'mode', ''):
|
||||
# `mode` might be `None` (Ref: https://github.com/yt-dlp/yt-dlp/issues/8816)
|
||||
if 'b' in (getattr(out, 'mode', None) or ''):
|
||||
enc = encoding or preferredencoding()
|
||||
elif hasattr(out, 'buffer'):
|
||||
buffer = out.buffer
|
||||
|
|
Loading…
Reference in a new issue