From 5062ef771207de8c5c73488fff010c8232b1820c Mon Sep 17 00:00:00 2001 From: Marvin Ewald Date: Tue, 4 Apr 2017 19:18:23 +0200 Subject: [PATCH] [Streamango] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/streamango.py | 38 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 youtube_dl/extractor/streamango.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 2904dd4d1..4fb9cd06b 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -934,6 +934,7 @@ from .srmediathek import SRMediathekIE from .stanfordoc import StanfordOpenClassroomIE from .steam import SteamIE from .streamable import StreamableIE +from .streamango import StreamangoIE from .streamcloud import StreamcloudIE from .streamcz import StreamCZIE from .streetvoice import StreetVoiceIE diff --git a/youtube_dl/extractor/streamango.py b/youtube_dl/extractor/streamango.py new file mode 100644 index 000000000..83cd8313b --- /dev/null +++ b/youtube_dl/extractor/streamango.py @@ -0,0 +1,38 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class StreamangoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?streamango\.com/(?:f|embed)/(?P.+?)/(?:.+)' + _TESTS = [{ + 'url': 'https://streamango.com/f/clapasobsptpkdfe/20170315_150006_mp4', + 'md5': 'e992787515a182f55e38fc97588d802a', + 'info_dict': { + 'id': 'clapasobsptpkdfe', + 'ext': 'mp4', + 'title': '20170315_150006.mp4', + 'url': r're:https://streamango\.com/v/d/clapasobsptpkdfe~[0-9]{10}~185\.61\.0\.0~.{8}/720', + } + }, { + 'url': 'https://streamango.com/embed/clapasobsptpkdfe/20170315_150006_mp4', + 'only_matching': True, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + title = self._og_search_title(webpage) + + url = "https:" + self._search_regex( + r'type\s*:\s*["\']video/mp4["\']\s*,\s*src\s*:\s*["\'](?P.+?)["\'].*', + webpage, 'video URL', group='url') + + return { + 'id': video_id, + 'url': url, + 'title': title, + 'ext': 'mp4', + }