aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustsoos <justso@gmail.com>2017-02-01 21:30:01 +0800
committerSergey M․ <dstftw@gmail.com>2017-02-03 03:26:41 +0700
commit33da98f4933ddc54c944bae985cfcc7b53563208 (patch)
tree8dda2a6c957bea82d303e7c278e74c248e65e590
parent4195096ea8da8237a63e1ba3876dc8856b8605c6 (diff)
[douyutv] Improve room id regex
http://www.douyu.com/t/lpl source get extra '\' with "room_id\" (from js coding)
-rw-r--r--youtube_dl/extractor/douyutv.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/douyutv.py b/youtube_dl/extractor/douyutv.py
index 2f3c5113e..911594413 100644
--- a/youtube_dl/extractor/douyutv.py
+++ b/youtube_dl/extractor/douyutv.py
@@ -18,7 +18,7 @@ from ..utils import (
class DouyuTVIE(InfoExtractor):
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 = [{
'url': 'http://www.douyutv.com/iseven',
'info_dict': {
@@ -68,6 +68,10 @@ class DouyuTVIE(InfoExtractor):
}, {
'url': 'http://www.douyu.com/xiaocang',
'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
@@ -82,7 +86,7 @@ class DouyuTVIE(InfoExtractor):
else:
page = self._download_webpage(url, video_id)
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(
'http://m.douyu.com/html5/live?roomId=%s' % room_id, video_id,