[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / webcaster.py
index d366511a20818d5640a6125195f06f4ca3b30120..e4b65f54f5278009476f096c09f68fd69ccff478 100644 (file)
@@ -20,7 +20,7 @@ class WebcasterIE(InfoExtractor):
             'id': 'c8cefd240aa593681c8d068cff59f407_hd',
             'ext': 'mp4',
             'title': 'Сибирь - Нефтехимик. Лучшие моменты первого периода',
-            'thumbnail': 're:^https?://.*\.jpg$',
+            'thumbnail': r're:^https?://.*\.jpg$',
         },
     }, {
         'url': 'http://bl.webcaster.pro/media/start/free_6246c7a4453ac4c42b4398f840d13100_hd/2_2991109016/e8d0d82587ef435480118f9f9c41db41/4635726126',
@@ -74,6 +74,23 @@ class WebcasterFeedIE(InfoExtractor):
         'only_matching': True,
     }
 
+    @staticmethod
+    def _extract_url(ie, webpage):
+        mobj = re.search(
+            r'<(?:object|a[^>]+class=["\']webcaster-player["\'])[^>]+data(?:-config)?=(["\']).*?config=(?P<url>https?://bl\.webcaster\.pro/feed/start/free_.*?)(?:[?&]|\1)',
+            webpage)
+        if mobj:
+            return mobj.group('url')
+        for secure in (True, False):
+            video_url = ie._og_search_video_url(
+                webpage, secure=secure, default=None)
+            if video_url:
+                mobj = re.search(
+                    r'config=(?P<url>https?://bl\.webcaster\.pro/feed/start/free_[^?&=]+)',
+                    video_url)
+                if mobj:
+                    return mobj.group('url')
+
     def _real_extract(self, url):
         video_id = self._match_id(url)