]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[extractor/generic] Add support for openload embeds (closes #11536, closes #11812)
authorSergey M․ <dstftw@gmail.com>
Wed, 25 Jan 2017 16:27:22 +0000 (23:27 +0700)
committerSergey M․ <dstftw@gmail.com>
Wed, 25 Jan 2017 16:27:22 +0000 (23:27 +0700)
youtube_dl/extractor/generic.py
youtube_dl/extractor/openload.py

index 40201f3119b69b4d703881ff97523f99285ffbd6..a23486620b8d8d9a9c81714b56777ebe3587c581 100644 (file)
@@ -80,6 +80,7 @@ from .piksel import PikselIE
 from .videa import VideaIE
 from .twentymin import TwentyMinutenIE
 from .ustream import UstreamIE
+from .openload import OpenloadIE
 
 
 class GenericIE(InfoExtractor):
@@ -2431,6 +2432,12 @@ class GenericIE(InfoExtractor):
             return _playlist_from_matches(
                 twentymin_urls, ie=TwentyMinutenIE.ie_key())
 
+        # Look for Openload embeds
+        openload_urls = OpenloadIE._extract_urls(webpage)
+        if openload_urls:
+            return _playlist_from_matches(
+                openload_urls, ie=OpenloadIE.ie_key())
+
         # Looking for http://schema.org/VideoObject
         json_ld = self._search_json_ld(
             webpage, video_id, default={}, expected_type='VideoObject')
index 3d4ad7dca469a2da4430818ac3119de156f74420..4893ade5d7998700ec787c3ee498a2fe5eddff11 100644 (file)
@@ -1,6 +1,8 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
+import re
+
 from .common import InfoExtractor
 from ..compat import compat_chr
 from ..utils import (
@@ -56,6 +58,12 @@ class OpenloadIE(InfoExtractor):
         'only_matching': True,
     }]
 
+    @staticmethod
+    def _extract_urls(webpage):
+        return re.findall(
+            r'<iframe[^>]+src=["\']((?:https?://)?(?:openload\.(?:co|io)|oload\.tv)/embed/[a-zA-Z0-9-_]+)',
+            webpage)
+
     def _real_extract(self, url):
         video_id = self._match_id(url)
         webpage = self._download_webpage('https://openload.co/embed/%s/' % video_id, video_id)