mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-05 12:00:21 +00:00
[bilibili] extract multiple backup_urls
This commit is contained in:
parent
520e753390
commit
497f5fd93f
@ -69,21 +69,22 @@ def _real_extract(self, url):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
doc = ET.fromstring(page)
|
doc = ET.fromstring(page)
|
||||||
durls = doc.findall('./durl')
|
|
||||||
|
|
||||||
entries = []
|
entries = []
|
||||||
|
|
||||||
for durl in durls:
|
for durl in doc.findall('./durl'):
|
||||||
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')
|
size = durl.find('./filesize|./size')
|
||||||
formats.append({
|
formats = [{
|
||||||
'url': durl.find('./url').text,
|
'url': durl.find('./url').text,
|
||||||
'filesize': int_or_none(size.text) if size else None,
|
'filesize': int_or_none(size.text) if size else None,
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
})
|
}]
|
||||||
|
backup_urls = durl.find('./backup_url')
|
||||||
|
if backup_urls is not None:
|
||||||
|
for backup_url in backup_urls.findall('./url'):
|
||||||
|
formats.append({'url': backup_url.text})
|
||||||
|
formats.reverse()
|
||||||
|
|
||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user