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