aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/bilibili.py
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2015-10-21 08:24:05 +0100
committerremitamine <remitamine@gmail.com>2015-10-21 08:24:05 +0100
commit497f5fd93fe1efd0df8dc58d518c328ed1409457 (patch)
tree95b63f873380a13b47a10345526f64edd33ccf5d /youtube_dl/extractor/bilibili.py
parent520e753390aab5845bb257b964ebcd6f818455df (diff)
[bilibili] extract multiple backup_urls
Diffstat (limited to 'youtube_dl/extractor/bilibili.py')
-rw-r--r--youtube_dl/extractor/bilibili.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py
index e00efb6eb..935fcc55c 100644
--- a/youtube_dl/extractor/bilibili.py
+++ b/youtube_dl/extractor/bilibili.py
@@ -69,21 +69,22 @@ class BiliBiliIE(InfoExtractor):
pass
doc = ET.fromstring(page)
- durls = doc.findall('./durl')
entries = []
- 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})
+ for durl in doc.findall('./durl'):
size = durl.find('./filesize|./size')
- formats.append({
+ formats = [{
'url': durl.find('./url').text,
'filesize': int_or_none(size.text) if size else None,
'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({
'id': '%s_part%s' % (cid, durl.find('./order').text),
'title': title,