0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-17 01:25:11 +00:00

[bilibili] extract backup url

This commit is contained in:
remitamine 2015-10-17 18:30:51 +01:00
parent d90e40305b
commit 55af2b26e0

View file

@ -58,13 +58,21 @@ def _extract_video_info(self, cid, view_data, page_num=1, num_pages=1):
entries = [] entries = []
for durl in durls: for durl in durls:
formats = []
backup_url = durl.find('./backup_url')
if backup_url is not None:
formats.append({'url': backup_url.find('./url').text})
size = durl.find('./filesize|./size')
formats.append({
'url': durl.find('./url').text,
'filesize': int_or_none(size.text) if size else None,
'ext': 'flv',
})
entries.append({ entries.append({
'id': '%s_part%s' % (cid, durl.find('./order').text), 'id': '%s_part%s' % (cid, durl.find('./order').text),
'title': title, 'title': title,
'url': durl.find('./url').text,
'filesize': int_or_none(durl.find('./filesize').text),
'ext': 'flv',
'duration': int_or_none(durl.find('./length').text) // 1000, 'duration': int_or_none(durl.find('./length').text) // 1000,
'formats': formats,
}) })
info = { info = {