]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[nexx] Improve JS embed extraction
authorSergey M․ <dstftw@gmail.com>
Sat, 15 Jul 2017 21:30:48 +0000 (04:30 +0700)
committerSergey M․ <dstftw@gmail.com>
Sat, 15 Jul 2017 21:30:48 +0000 (04:30 +0700)
youtube_dl/extractor/nexx.py

index 60b42cb7d0de0296b2da2d3b3470b1aa66da048b..12450d4c59ea8ece340f292812ff0b186acb8362 100644 (file)
@@ -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