mirror of
https://github.com/l1ving/youtube-dl
synced 2020-11-18 19:53:54 -08:00
[bilibili] Support paged videos
This commit is contained in:
parent
ea1f5e5dbd
commit
a0e35315e9
@ -23,7 +23,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class BiliBiliIE(InfoExtractor):
|
class BiliBiliIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.|bangumi\.|)bilibili\.(?:tv|com)/(?:video/av|anime/(?P<anime_id>\d+)/play#)(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.|bangumi\.|)bilibili\.(?:tv|com)/(?:video/av|anime/(?P<anime_id>\d+)/play#)(?P<id>\d+)(?:/?\?p=(?P<page>\d+))?'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.bilibili.tv/video/av1074402/',
|
'url': 'http://www.bilibili.tv/video/av1074402/',
|
||||||
@ -91,6 +91,22 @@ class BiliBiliIE(InfoExtractor):
|
|||||||
'skip_download': True, # Test metadata only
|
'skip_download': True, # Test metadata only
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
}, {
|
||||||
|
# Test pages
|
||||||
|
'url': 'http://www.bilibili.com/video/av19608864/?p=3',
|
||||||
|
'md5': 'e0c3368a3a1d53ac5892da1abe57887d',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19608864',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': '【iu】【penta kill】第七届Gaon Chart K-POP Awards~各种屏录~',
|
||||||
|
'description': 'md5:d9f59c5658f4f2eafc04a191e1ab0828',
|
||||||
|
'duration': 100.264,
|
||||||
|
'timestamp': 1518671057,
|
||||||
|
'upload_date': '20180215',
|
||||||
|
'thumbnail': r're:^https?://.+\.jpg',
|
||||||
|
'uploader': '普通的柒月初叁',
|
||||||
|
'uploader_id': '260251749',
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
_APP_KEY = '84956560bc028eb7'
|
_APP_KEY = '84956560bc028eb7'
|
||||||
@ -110,14 +126,14 @@ class BiliBiliIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
anime_id = mobj.group('anime_id')
|
anime_id = mobj.group('anime_id')
|
||||||
|
page = mobj.group('page') or 1
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
if 'anime/' not in url:
|
if 'anime/' not in url:
|
||||||
cid = self._search_regex(
|
mobj = re.findall(r'cid(?:["\']:|=)(\d+)', webpage)
|
||||||
r'cid(?:["\']:|=)(\d+)', webpage, 'cid',
|
cid = mobj[int(page) - 1] or \
|
||||||
default=None
|
compat_parse_qs(self._search_regex([
|
||||||
) or compat_parse_qs(self._search_regex(
|
r'EmbedPlayer\([^)]+,\s*"([^"]+)"\)',
|
||||||
[r'EmbedPlayer\([^)]+,\s*"([^"]+)"\)',
|
|
||||||
r'EmbedPlayer\([^)]+,\s*\\"([^"]+)\\"\)',
|
r'EmbedPlayer\([^)]+,\s*\\"([^"]+)\\"\)',
|
||||||
r'<iframe[^>]+src="https://secure\.bilibili\.com/secure,([^"]+)"'],
|
r'<iframe[^>]+src="https://secure\.bilibili\.com/secure,([^"]+)"'],
|
||||||
webpage, 'player parameters'))['cid'][0]
|
webpage, 'player parameters'))['cid'][0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user