aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/safari.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-08-01 21:48:48 +0700
committerSergey M․ <dstftw@gmail.com>2016-08-01 21:48:48 +0700
commit697655a7c0c1469dd7474714652025961e82bd69 (patch)
treefdd3716a7e973fc00f123e0f36b515086fe2de37 /youtube_dl/extractor/safari.py
parente382b953f00982a2085d3e0b1b6fb4d2a0f2db7e (diff)
[safari] Relax url regexes (Closes #10202)
Diffstat (limited to 'youtube_dl/extractor/safari.py')
-rw-r--r--youtube_dl/extractor/safari.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/youtube_dl/extractor/safari.py b/youtube_dl/extractor/safari.py
index 6ba91f202..08ddbe3c4 100644
--- a/youtube_dl/extractor/safari.py
+++ b/youtube_dl/extractor/safari.py
@@ -75,7 +75,7 @@ class SafariBaseIE(InfoExtractor):
class SafariIE(SafariBaseIE):
IE_NAME = 'safari'
IE_DESC = 'safaribooksonline.com online video'
- _VALID_URL = r'https?://(?:www\.)?safaribooksonline\.com/library/view/[^/]+/(?P<course_id>[^/]+)/(?P<part>part\d+)\.html'
+ _VALID_URL = r'https?://(?:www\.)?safaribooksonline\.com/library/view/[^/]+/(?P<course_id>[^/]+)/(?P<part>[^/?#&]+)\.html'
_TESTS = [{
'url': 'https://www.safaribooksonline.com/library/view/hadoop-fundamentals-livelessons/9780133392838/part00.html',
@@ -92,6 +92,9 @@ class SafariIE(SafariBaseIE):
# non-digits in course id
'url': 'https://www.safaribooksonline.com/library/view/create-a-nodejs/100000006A0210/part00.html',
'only_matching': True,
+ }, {
+ 'url': 'https://www.safaribooksonline.com/library/view/learning-path-red/9780134664057/RHCE_Introduction.html',
+ 'only_matching': True,
}]
def _real_extract(self, url):
@@ -132,12 +135,15 @@ class SafariIE(SafariBaseIE):
class SafariApiIE(SafariBaseIE):
IE_NAME = 'safari:api'
- _VALID_URL = r'https?://(?:www\.)?safaribooksonline\.com/api/v1/book/(?P<course_id>[^/]+)/chapter(?:-content)?/(?P<part>part\d+)\.html'
+ _VALID_URL = r'https?://(?:www\.)?safaribooksonline\.com/api/v1/book/(?P<course_id>[^/]+)/chapter(?:-content)?/(?P<part>[^/?#&]+)\.html'
- _TEST = {
+ _TESTS = [{
'url': 'https://www.safaribooksonline.com/api/v1/book/9780133392838/chapter/part00.html',
'only_matching': True,
- }
+ }, {
+ 'url': 'https://www.safaribooksonline.com/api/v1/book/9780134664057/chapter/RHCE_Introduction.html',
+ 'only_matching': True,
+ }]
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)