]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[generic] Add support for vzaar embeds
authortetra-eder <30865771+tetra-eder@users.noreply.github.com>
Fri, 11 Aug 2017 15:00:39 +0000 (17:00 +0200)
committerSergey M <dstftw@gmail.com>
Fri, 11 Aug 2017 15:00:39 +0000 (22:00 +0700)
youtube_dl/extractor/generic.py
youtube_dl/extractor/vzaar.py

index 34e814988e73a94d81b35b4a0eac000b1b62076c..51acead662d04bd29fb93cf5a9604f6c5294a899 100644 (file)
@@ -98,6 +98,7 @@ from .wistia import WistiaIE
 from .mediaset import MediasetIE
 from .joj import JojIE
 from .megaphone import MegaphoneIE
+from .vzaar import VzaarIE
 
 
 class GenericIE(InfoExtractor):
@@ -1840,6 +1841,16 @@ class GenericIE(InfoExtractor):
                 'title': 'Стас Намин: «Мы нарушили девственность Кремля»',
             },
         },
+        {
+            # vzaar embed
+            'url': 'http://www.xruniversity.com/bdsm-lets-begin-melissa-moore/',
+            'md5': 'cddc9fb8a8644a0a7742149eee95080b',
+            'info_dict': {
+                'id': '11002506',
+                'ext': 'mp4',
+                'title': 'XR-U SHOW: Ready Player Fuck - EP. 61',
+            },
+        },
         # {
         #     # TODO: find another test
         #     # http://schema.org/VideoObject
@@ -2781,6 +2792,12 @@ class GenericIE(InfoExtractor):
             return self.playlist_from_matches(
                 videopress_urls, video_id, video_title, ie=VideoPressIE.ie_key())
 
+        # Look for vzaar embeds
+        vzaar_urls = VzaarIE._extract_urls(webpage)
+        if vzaar_urls:
+            return self.playlist_from_matches(
+                vzaar_urls, video_id, video_title, ie=VzaarIE.ie_key())
+
         # Look for Rutube embeds
         rutube_urls = RutubeIE._extract_urls(webpage)
         if rutube_urls:
index b270f08d1e8796889ac54e4885c2234e4e7eb46b..02fcd52c74c268ea8274359af46810a6beeb0636 100644 (file)
@@ -1,6 +1,8 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
+import re
+
 from .common import InfoExtractor
 from ..utils import (
     int_or_none,
@@ -28,6 +30,12 @@ class VzaarIE(InfoExtractor):
         },
     }]
 
+    @staticmethod
+    def _extract_urls(webpage):
+        return re.findall(
+            r'<iframe[^>]+src=["\']((?:https?:)?//(?:view\.vzaar\.com)/[0-9]+)',
+            webpage)
+
     def _real_extract(self, url):
         video_id = self._match_id(url)
         video_data = self._download_json(