]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/videomore.py
[extractors] Use new framework for existing embeds (#4307)
[yt-dlp.git] / yt_dlp / extractor / videomore.py
index 09d12d192e3734c66be1d1113d34fec8ec88dedf..2f81860bb7dc81c70077bf8416f8cc5c7c02e27b 100644 (file)
@@ -1,5 +1,3 @@
-import re
-
 from .common import InfoExtractor
 from ..compat import (
     compat_str,
@@ -47,6 +45,12 @@ class VideomoreIE(InfoExtractor):
                         (?P<id>\d+)
                         (?:[/?#&]|\.(?:xml|json)|$)
                     '''
+    _EMBED_REGEX = [r'''(?x)
+        (?:
+            <iframe[^>]+src=([\'"])|
+            <object[^>]+data=(["\'])https?://videomore\.ru/player\.swf\?.*config=
+        )(?P<url>https?://videomore\.ru/[^?#"']+/\d+(?:\.xml)?)
+    ''']
     _TESTS = [{
         'url': 'http://videomore.ru/kino_v_detalayah/5_sezon/367617',
         'md5': '44455a346edc0d509ac5b5a5b531dc35',
@@ -126,19 +130,6 @@ class VideomoreIE(InfoExtractor):
     }]
     _GEO_BYPASS = False
 
-    @staticmethod
-    def _extract_url(webpage):
-        mobj = re.search(
-            r'<object[^>]+data=(["\'])https?://videomore\.ru/player\.swf\?.*config=(?P<url>https?://videomore\.ru/(?:[^/]+/)+\d+\.xml).*\1',
-            webpage)
-        if not mobj:
-            mobj = re.search(
-                r'<iframe[^>]+src=([\'"])(?P<url>https?://videomore\.ru/embed/\d+)',
-                webpage)
-
-        if mobj:
-            return mobj.group('url')
-
     def _real_extract(self, url):
         mobj = self._match_valid_url(url)
         video_id = mobj.group('sid') or mobj.group('id')