Compare commits

...

3 Commits

Author SHA1 Message Date
c-basalt
ad16c982f4
Update yt_dlp/extractor/bilibili.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-11-18 22:06:01 -05:00
c-basalt
dbbab38a39 move extractor key to base class 2023-11-18 21:47:02 -05:00
c-basalt
5bf01789a7
Update yt_dlp/extractor/bilibili.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-11-18 21:22:28 -05:00

View File

@ -179,11 +179,11 @@ class BilibiliBaseIE(InfoExtractor):
'https://api.bilibili.com/x/stein/edgeinfo_v2', video_id,
query={'graph_version': graph_version, 'edge_id': edge_id, 'bvid': video_id},
note=f'Extracting divisions from edge {edge_id}')
for node in traverse_obj(division_data, ('data', 'story_list', lambda _, v: v['edge_id'] == edge_id)):
edges.setdefault(node['edge_id'], {}).update(traverse_obj(node, {
edges.setdefault(edge_id, {}).update(
traverse_obj(division_data, ('data', 'story_list', lambda _, v: v['edge_id'] == edge_id, {
'title': ('title', {str}),
'cid': ('cid', {int_or_none}),
}))
}), get_all=False))
edges[edge_id].update(traverse_obj(division_data, ('data', {
'title': ('title', {str}),
@ -855,6 +855,9 @@ class BilibiliCheeseBaseIE(BilibiliBaseIE):
'id': str_or_none(ep_id),
'episode_id': str_or_none(ep_id),
'formats': self.extract_formats(play_info),
'extractor_key': BilibiliCheeseIE.ie_key(),
'extractor': BilibiliCheeseIE.IE_NAME,
'webpage_url': f'https://www.bilibili.com/cheese/play/ep{ep_id}',
**traverse_obj(episode_info, {
'episode': ('title', {str}),
'title': {lambda v: v and join_nonempty('index', 'title', delim=' - ', from_dict=v)},
@ -948,11 +951,7 @@ class BilibiliCheeseSeasonIE(BilibiliCheeseBaseIE):
def _get_cheese_entries(self, season_info):
for ep_id in traverse_obj(season_info, ('episodes', lambda _, v: v['episode_can_view'], 'id')):
yield {
**self._extract_episode(season_info, ep_id),
'extractor_key': BilibiliCheeseIE.ie_key(),
'extractor': BilibiliCheeseIE.IE_NAME,
}
yield self._extract_episode(season_info, ep_id)
def _real_extract(self, url):
season_id = self._match_id(url)