[cleanup] Minor cleanup

Closes #1696, Closes #1673
This commit is contained in:
pukkandan
2021-11-19 05:36:28 +05:30
parent 467b6b8387
commit 9222c38182
12 changed files with 74 additions and 60 deletions

View File

@@ -185,7 +185,7 @@ class FranceTVIE(InfoExtractor):
'vcodec': 'none',
'ext': 'mhtml',
'protocol': 'mhtml',
'url': 'about:dummy',
'url': 'about:invalid',
'fragments': [{
'path': sheet,
# XXX: not entirely accurate; each spritesheet seems to be

View File

@@ -276,7 +276,7 @@ class FunimationIE(FunimationBaseIE):
def _get_subtitles(self, subtitles, experience_id, episode, display_id, format_name):
if isinstance(episode, str):
webpage = self._download_webpage(
f'https://www.funimation.com/player/{experience_id}', display_id,
f'https://www.funimation.com/player/{experience_id}/', display_id,
fatal=False, note=f'Downloading player webpage for {format_name}')
episode, _, _ = self._get_episode(webpage, episode_id=episode, fatal=False)

View File

@@ -109,7 +109,7 @@ class LinkedInIE(LinkedInBaseIE):
description = clean_html(get_element_by_class('share-update-card__update-text', webpage))
like_count = int_or_none(get_element_by_class('social-counts-reactions__social-counts-numRections', webpage))
creator = strip_or_none(clean_html(get_element_by_class('comment__actor-name', webpage)))
sources = self._parse_json(extract_attributes(self._search_regex(r'(<video[^>]+>)', webpage, 'video'))['data-sources'], video_id)
formats = [{
'url': source['src'],

View File

@@ -193,7 +193,7 @@ class PBSIE(InfoExtractor):
# Article with embedded player (or direct video)
(?:www\.)?pbs\.org/(?:[^/]+/){1,5}(?P<presumptive_id>[^/]+?)(?:\.html)?/?(?:$|[?\#]) |
# Player
(?:video|player)\.pbs\.org/(?:widget/)?partnerplayer/(?P<player_id>[^/]+)/
(?:video|player)\.pbs\.org/(?:widget/)?partnerplayer/(?P<player_id>[^/]+)
)
''' % '|'.join(list(zip(*_STATIONS))[0])

View File

@@ -58,7 +58,7 @@ class TenPlayIE(InfoExtractor):
'email': username,
'password': password,
}))
return "Bearer " + data['jwt']['accessToken']
return 'Bearer ' + data['jwt']['accessToken']
def _real_extract(self, url):
content_id = self._match_id(url)

View File

@@ -508,9 +508,9 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
Extracts visitorData from an API response or ytcfg
Appears to be used to track session state
"""
return traverse_obj(
args, (..., ('VISITOR_DATA', ('INNERTUBE_CONTEXT', 'client', 'visitorData'), ('responseContext', 'visitorData'))),
expected_type=compat_str, get_all=False)
return get_first(
args, (('VISITOR_DATA', ('INNERTUBE_CONTEXT', 'client', 'visitorData'), ('responseContext', 'visitorData'))),
expected_type=str)
@property
def is_authenticated(self):
@@ -1674,7 +1674,20 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
# shorts
'url': 'https://www.youtube.com/shorts/BGQWPY4IigY',
'only_matching': True,
},
}, {
'note': 'Storyboards',
'url': 'https://www.youtube.com/watch?v=5KLPxDtMqe8',
'info_dict': {
'id': '5KLPxDtMqe8',
'ext': 'mhtml',
'format_id': 'sb0',
'title': 'Your Brain is Plastic',
'uploader_id': 'scishow',
'description': 'md5:89cd86034bdb5466cd87c6ba206cd2bc',
'upload_date': '20140324',
'uploader': 'SciShow',
}, 'params': {'format': 'mhtml', 'skip_download': True}
}
]
@classmethod
@@ -1920,9 +1933,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
return sts
def _mark_watched(self, video_id, player_responses):
playback_url = traverse_obj(
player_responses, (..., 'playbackTracking', 'videostatsPlaybackUrl', 'baseUrl'),
expected_type=url_or_none, get_all=False)
playback_url = get_first(
player_responses, ('playbackTracking', 'videostatsPlaybackUrl', 'baseUrl'),
expected_type=url_or_none)
if not playback_url:
self.report_warning('Unable to mark watched')
return