[joj] Relax _VALID_URL (closes #16771)
authorSergey M․ <dstftw@gmail.com>
Sun, 24 Jun 2018 16:57:22 +0000 (23:57 +0700)
committerSergey M․ <dstftw@gmail.com>
Sun, 24 Jun 2018 16:57:22 +0000 (23:57 +0700)
youtube_dl/extractor/joj.py

index a764023e9f82a07bc96f6eaab293daf224a1c91a..d9f8dbfd240db90fac3ddcfd23dd76d095cef52a 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