diff --git a/youtube_dl/extractor/disneyplus.py b/youtube_dl/extractor/disneyplus.py new file mode 100644 index 000000000..7a2aeed39 --- /dev/null +++ b/youtube_dl/extractor/disneyplus.py @@ -0,0 +1,34 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import int_or_none + + +class DisneyPlusIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?disneyplus\.com/[^/]+/[^/]+/(?P.+?)--\d+.html' + _TEST = { + } + _VIDEO_BASE = 'http://disneyplus.com/services/mobile/streaming/index/master.m3u8?videoId=' + + def _real_extract(self, url): + display_id = re.match(self._VALID_URL, url).groups() + webpage = self._download_webpage(url, display_id) + video_figure = self._search_regex(r']+class=\"media-video\"[^>]+itemtype=\"http://schema\.org/VideoObject\"*>(.*?)', webpage, 'video_figure', flags=re.DOTALL) + video_id = self._search_regex(r'', video_figure, 'video_id', flags=re.DOTALL) + name = self._search_regex(r'', video_figure, 'name', flags=re.DOTALL) + description = self._html_search_regex(r'', video_figure, 'description', flags=re.DOTALL) + thumbnail = self._search_regex(r'', video_figure, 'thumbnail', flags=re.DOTALL) + timestamp = self._search_regex(r'', video_figure, 'timestamp', flags=re.DOTALL) + formats = self._extract_m3u8_formats(self._VIDEO_BASE + video_id, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False) + return { + 'id': video_id, + 'display_id': display_id, + 'title': name, + 'description': description, + 'thumbnail': thumbnail, + 'timestamp': int_or_none(timestamp), + 'formats': formats + }