[extractor/generic:myvi] Add support for myvi embeds
authorSergey M․ <dstftw@gmail.com>
Thu, 9 Jul 2015 18:25:36 +0000 (00:25 +0600)
committerSergey M․ <dstftw@gmail.com>
Thu, 9 Jul 2015 18:25:36 +0000 (00:25 +0600)
youtube_dl/extractor/generic.py
youtube_dl/extractor/myvi.py

index ea60d4a96cb86a6d22406be7f92b6d1fdcb8eceb..f8d6a8c765d82a551543cd2e8c97bca7c0056b70 100644 (file)
@@ -37,6 +37,7 @@ from .rutv import RUTVIE
 from .tvc import TVCIE
 from .sportbox import SportBoxEmbedIE
 from .smotri import SmotriIE
+from .myvi import MyviEmbedIE
 from .condenast import CondeNastIE
 from .udn import UDNEmbedIE
 from .senateisvp import SenateISVPIE
@@ -1425,6 +1426,11 @@ class GenericIE(InfoExtractor):
         if smotri_url:
             return self.url_result(smotri_url, 'Smotri')
 
+        # Look for embedded Myvi.ru player
+        myvi_url = MyviEmbedIE._extract_url(webpage)
+        if myvi_url:
+            return self.url_result(myvi_url)
+
         # Look for embeded soundcloud player
         mobj = re.search(
             r'<iframe\s+(?:[a-zA-Z0-9_-]+="[^"]+"\s+)*src="(?P<url>https?://(?:w\.)?soundcloud\.com/player[^"]+)"',
index a14a5365b4889792651d8f45503491e76ec2971d..896080c1e50a3d47f7f2c3f2afd5e060f6c32d87 100644 (file)
@@ -1,6 +1,8 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
+import re
+
 from .vimple import SprutoBaseIE
 
 
@@ -38,6 +40,13 @@ class MyviEmbedIE(SprutoBaseIE):
         'only_matching': True,
     }]
 
+    @classmethod
+    def _extract_url(cls, webpage):
+        mobj = re.search(
+            r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//myvi\.(?:ru/player|tv)/embed/html/[^"]+)\1', webpage)
+        if mobj:
+            return mobj.group('url')
+
     def _real_extract(self, url):
         video_id = self._match_id(url)