[cleanup] Lint and misc cleanup

This commit is contained in:
pukkandan
2022-11-07 02:29:58 +05:30
parent db4678e448
commit 46d09f8707
11 changed files with 46 additions and 43 deletions

View File

@@ -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)

View File

@@ -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')):

View File

@@ -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):

View File

@@ -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'))

View File

@@ -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)

View File

@@ -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')