[stretchinternet] Add extractor
authorAndrew Bottom <abottom@wennsoft.com>
Tue, 24 Oct 2017 16:50:02 +0000 (11:50 -0500)
committerSergey M․ <dstftw@gmail.com>
Sat, 9 Dec 2017 10:58:49 +0000 (17:58 +0700)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/stretchinternet.py [new file with mode: 0644]

index 0177a2cff043159e40eddd34462a2f845981e31f..612fd35d4dfe5d9f1d8ea4926c522e5566ffbe50 100644 (file)
@@ -1001,6 +1001,7 @@ from .streamango import StreamangoIE
 from .streamcloud import StreamcloudIE
 from .streamcz import StreamCZIE
 from .streetvoice import StreetVoiceIE
+from .stretchinternet import StretchInternetIE
 from .sunporno import SunPornoIE
 from .svt import (
     SVTIE,
diff --git a/youtube_dl/extractor/stretchinternet.py b/youtube_dl/extractor/stretchinternet.py
new file mode 100644 (file)
index 0000000..9a0ec0e
--- /dev/null
@@ -0,0 +1,28 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StretchInternetIE(InfoExtractor):
+    IE_DESC = 'StretchInternet'
+    _VALID_URL = r'https?://.*?stretchinternet\.com/[^/_?].*(?<=eventId=)(?P<id>.*)(?=&).*'
+    _TEST = {
+        'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=313900&streamType=video',
+        'info_dict': {
+            'id': '313900',
+            'ext': 'mp4',
+            'title': 'StretchInternet'
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        stream = self._download_json('https://neo-client.stretchinternet.com/streamservice/v1/media/stream/v%s' % video_id, video_id)
+        stream_url = stream.get('source')
+        return {
+            'ie_key': 'Generic',
+            'id': video_id,
+            'url': 'http://%s' % stream_url,
+            'title': 'StretchInternet'
+        }