]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/ministrygrid.py
[test/cookies] Improve logging
[yt-dlp.git] / yt_dlp / extractor / ministrygrid.py
CommitLineData
4d54ef20
PH
1from __future__ import unicode_literals
2
4d54ef20
PH
3from .common import InfoExtractor
4from ..utils import (
5 ExtractorError,
6 smuggle_url,
7)
8
9
10class MinistryGridIE(InfoExtractor):
92519402 11 _VALID_URL = r'https?://(?:www\.)?ministrygrid\.com/([^/?#]*/)*(?P<id>[^/#?]+)/?(?:$|[?#])'
4d54ef20
PH
12
13 _TEST = {
14 'url': 'http://www.ministrygrid.com/training-viewer/-/training/t4g-2014-conference/the-gospel-by-numbers-4/the-gospel-by-numbers',
15 'md5': '844be0d2a1340422759c2a9101bab017',
16 'info_dict': {
17 'id': '3453494717001',
18 'ext': 'mp4',
19 'title': 'The Gospel by Numbers',
ec85ded8 20 'thumbnail': r're:^https?://.*\.jpg',
56f17500
YCH
21 'upload_date': '20140410',
22 'description': 'Coming soon from T4G 2014!',
23 'uploader_id': '2034960640001',
24 'timestamp': 1397145591,
8cb57bab
YCH
25 },
26 'params': {
27 # m3u8 download
28 'skip_download': True,
4d54ef20 29 },
56f17500 30 'add_ie': ['TDSLifeway'],
4d54ef20
PH
31 }
32
33 def _real_extract(self, url):
8cb57bab 34 video_id = self._match_id(url)
4d54ef20
PH
35
36 webpage = self._download_webpage(url, video_id)
8cb57bab
YCH
37 portlets = self._parse_json(self._search_regex(
38 r'Liferay\.Portlet\.list=(\[.+?\])', webpage, 'portlet list'),
39 video_id)
4d54ef20 40 pl_id = self._search_regex(
8cb57bab 41 r'getPlid:function\(\){return"(\d+)"}', webpage, 'p_l_id')
4d54ef20
PH
42
43 for i, portlet in enumerate(portlets):
44 portlet_url = 'http://www.ministrygrid.com/c/portal/render_portlet?p_l_id=%s&p_p_id=%s' % (pl_id, portlet)
45 portlet_code = self._download_webpage(
46 portlet_url, video_id,
47 note='Looking in portlet %s (%d/%d)' % (portlet, i + 1, len(portlets)),
48 fatal=False)
49 video_iframe_url = self._search_regex(
50 r'<iframe.*?src="([^"]+)"', portlet_code, 'video iframe',
51 default=None)
52 if video_iframe_url:
8cb57bab
YCH
53 return self.url_result(
54 smuggle_url(video_iframe_url, {'force_videoid': video_id}),
55 video_id=video_id)
4d54ef20
PH
56
57 raise ExtractorError('Could not find video iframe in any portlets')