summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-07-16 04:30:48 +0700
committerSergey M․ <dstftw@gmail.com>2017-07-16 04:30:48 +0700
commit089b97cfee8553886d33cd52b7ede178cebd7034 (patch)
treed8de7d83ac50bac1bbdbd9f47a549d91ccaa157d
parentdecf86044d17a8ec04e43a4805a0092622d976ae (diff)
downloadyoutube-dl-089b97cfee8553886d33cd52b7ede178cebd7034.tar.gz
youtube-dl-089b97cfee8553886d33cd52b7ede178cebd7034.tar.xz
youtube-dl-089b97cfee8553886d33cd52b7ede178cebd7034.zip
[nexx] Improve JS embed extraction
-rw-r--r--youtube_dl/extractor/nexx.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/youtube_dl/extractor/nexx.py b/youtube_dl/extractor/nexx.py
index 60b42cb7d..12450d4c5 100644
--- a/youtube_dl/extractor/nexx.py
+++ b/youtube_dl/extractor/nexx.py
@@ -72,13 +72,17 @@ class NexxIE(InfoExtractor):
         entries = []
 
         # JavaScript Integration
-        for domain_id, video_id in re.findall(
-                r'''(?isx)
-                    <script\b[^>]+\bsrc=["\']https?://require\.nexx(?:\.cloud|cdn\.com)/(\d+).+?
-                    onPLAYReady.+?
-                    _play\.init\s*\(.+?\s*,\s*(\d+)\s*,\s*.+?\)
-                ''', webpage):
-            entries.append('https://api.nexx.cloud/v3/%s/videos/byid/%s' % (domain_id, video_id))
+        mobj = re.search(
+            r'<script\b[^>]+\bsrc=["\']https?://require\.nexx(?:\.cloud|cdn\.com)/(?P<id>\d+)',
+            webpage)
+        if mobj:
+            domain_id = mobj.group('id')
+            for video_id in re.findall(
+                    r'(?is)onPLAYReady.+?_play\.init\s*\(.+?\s*,\s*["\']?(\d+)',
+                    webpage):
+                entries.append(
+                    'https://api.nexx.cloud/v3/%s/videos/byid/%s'
+                    % (domain_id, video_id))
 
         # TODO: support more embed formats