mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-28 01:18:30 +00:00
[ie/BilibiliSpaceVideo] Extract hidden-mode collections as playlists (#13533)
Closes #13435 Authored by: c-basalt
This commit is contained in:
parent
eff0759705
commit
99b85ac102
@ -1226,6 +1226,26 @@ class BilibiliSpaceVideoIE(BilibiliSpaceBaseIE):
|
|||||||
'id': '313580179',
|
'id': '313580179',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 92,
|
'playlist_mincount': 92,
|
||||||
|
}, {
|
||||||
|
# Hidden-mode collection
|
||||||
|
'url': 'https://space.bilibili.com/3669403/video',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '3669403',
|
||||||
|
},
|
||||||
|
'playlist': [{
|
||||||
|
'info_dict': {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': '3669403_3958082',
|
||||||
|
'title': '合集·直播回放',
|
||||||
|
'description': '',
|
||||||
|
'uploader': '月路Yuel',
|
||||||
|
'uploader_id': '3669403',
|
||||||
|
'timestamp': int,
|
||||||
|
'upload_date': str,
|
||||||
|
'thumbnail': str,
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
'params': {'playlist_items': '7'},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -1282,8 +1302,14 @@ def get_metadata(page_data):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_entries(page_data):
|
def get_entries(page_data):
|
||||||
for entry in traverse_obj(page_data, ('list', 'vlist')) or []:
|
for entry in traverse_obj(page_data, ('list', 'vlist', ..., {dict})):
|
||||||
yield self.url_result(f'https://www.bilibili.com/video/{entry["bvid"]}', BiliBiliIE, entry['bvid'])
|
if traverse_obj(entry, ('meta', 'attribute')) == 156:
|
||||||
|
# hidden-mode collection doesn't show its videos in uploads; extract as playlist instead
|
||||||
|
yield self.url_result(
|
||||||
|
f'https://space.bilibili.com/{entry["mid"]}/lists/{entry["meta"]["id"]}?type=season',
|
||||||
|
BilibiliCollectionListIE, f'{entry["mid"]}_{entry["meta"]["id"]}')
|
||||||
|
else:
|
||||||
|
yield self.url_result(f'https://www.bilibili.com/video/{entry["bvid"]}', BiliBiliIE, entry['bvid'])
|
||||||
|
|
||||||
metadata, paged_list = self._extract_playlist(fetch_page, get_metadata, get_entries)
|
metadata, paged_list = self._extract_playlist(fetch_page, get_metadata, get_entries)
|
||||||
return self.playlist_result(paged_list, playlist_id)
|
return self.playlist_result(paged_list, playlist_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user