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

[douyutv] Improve room id regex

http://www.douyu.com/t/lpl  source get extra '\' with "room_id\" (from js coding)
This commit is contained in:
Justsoos 2017-02-01 21:30:01 +08:00 committed by Sergey M․
parent 4195096ea8
commit 33da98f493
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -18,7 +18,7 @@
class DouyuTVIE(InfoExtractor): class DouyuTVIE(InfoExtractor):
IE_DESC = '斗鱼' IE_DESC = '斗鱼'
_VALID_URL = r'https?://(?:www\.)?douyu(?:tv)?\.com/(?P<id>[A-Za-z0-9]+)' _VALID_URL = r'https?://(?:www\.)?douyu(?:tv)?\.com/(?:[^/]+/)*(?P<id>[A-Za-z0-9]+)'
_TESTS = [{ _TESTS = [{
'url': 'http://www.douyutv.com/iseven', 'url': 'http://www.douyutv.com/iseven',
'info_dict': { 'info_dict': {
@ -68,6 +68,10 @@ class DouyuTVIE(InfoExtractor):
}, { }, {
'url': 'http://www.douyu.com/xiaocang', 'url': 'http://www.douyu.com/xiaocang',
'only_matching': True, 'only_matching': True,
}, {
# \"room_id\"
'url': 'http://www.douyu.com/t/lpl',
'only_matching': True,
}] }]
# Decompile core.swf in webpage by ffdec "Search SWFs in memory". core.swf # Decompile core.swf in webpage by ffdec "Search SWFs in memory". core.swf
@ -82,7 +86,7 @@ def _real_extract(self, url):
else: else:
page = self._download_webpage(url, video_id) page = self._download_webpage(url, video_id)
room_id = self._html_search_regex( room_id = self._html_search_regex(
r'"room_id"\s*:\s*(\d+),', page, 'room id') r'"room_id\\?"\s*:\s*(\d+),', page, 'room id')
room = self._download_json( room = self._download_json(
'http://m.douyu.com/html5/live?roomId=%s' % room_id, video_id, 'http://m.douyu.com/html5/live?roomId=%s' % room_id, video_id,