]> Raphaƫl G. Git Repositories - youtubedl/blobdiff - youtube_dl/extractor/joj.py
New upstream version 2020.06.16.1
[youtubedl] / youtube_dl / extractor / joj.py
index a764023e9f82a07bc96f6eaab293daf224a1c91a..62b28e9809856abaca23c4690c4670cacc96965a 100644 (file)
@@ -18,7 +18,7 @@ class JojIE(InfoExtractor):
                         joj:|\r
                         https?://media\.joj\.sk/embed/\r
                     )\r
-                    (?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})\r
+                    (?P<id>[^/?#^]+)\r
                 '''\r
     _TESTS = [{\r
         'url': 'https://media.joj.sk/embed/a388ec4c-6019-4a4a-9312-b1bee194e932',\r
@@ -29,16 +29,24 @@ class JojIE(InfoExtractor):
             'thumbnail': r're:^https?://.*\.jpg$',\r
             'duration': 3118,\r
         }\r
+    }, {\r
+        'url': 'https://media.joj.sk/embed/9i1cxv',\r
+        'only_matching': True,\r
     }, {\r
         'url': 'joj:a388ec4c-6019-4a4a-9312-b1bee194e932',\r
         'only_matching': True,\r
+    }, {\r
+        'url': 'joj:9i1cxv',\r
+        'only_matching': True,\r
     }]\r
 \r
     @staticmethod\r
     def _extract_urls(webpage):\r
-        return re.findall(\r
-            r'<iframe\b[^>]+\bsrc=["\'](?P<url>(?:https?:)?//media\.joj\.sk/embed/[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})',\r
-            webpage)\r
+        return [\r
+            mobj.group('url')\r
+            for mobj in re.finditer(\r
+                r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//media\.joj\.sk/embed/(?:(?!\1).)+)\1',\r
+                webpage)]\r
 \r
     def _real_extract(self, url):\r
         video_id = self._match_id(url)\r
@@ -53,7 +61,7 @@ class JojIE(InfoExtractor):
 \r
         bitrates = self._parse_json(\r
             self._search_regex(\r
-                r'(?s)bitrates\s*=\s*({.+?});', webpage, 'bitrates',\r
+                r'(?s)(?:src|bitrates)\s*=\s*({.+?});', webpage, 'bitrates',\r
                 default='{}'),\r
             video_id, transform_source=js_to_json, fatal=False)\r
 \r