diff options
author | remitamine <remitamine@gmail.com> | 2015-10-17 18:30:51 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2015-10-17 18:30:51 +0100 |
commit | 55af2b26e0f169bef2f10a7b5f6ec8e34c6dbb6d (patch) | |
tree | 37f0884155590bc7f0a8bf67feecddaf431363ef | |
parent | d90e40305bee84f5e3cd4927c729e1d16bbd3dc6 (diff) |
[bilibili] extract backup url
-rw-r--r-- | youtube_dl/extractor/bilibili.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 8f23a30ab..85156ce49 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -58,13 +58,21 @@ class BiliBiliIE(InfoExtractor): 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}) + 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({ 'id': '%s_part%s' % (cid, durl.find('./order').text), '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, + 'formats': formats, }) info = { |