1 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class MinistryGridIE(InfoExtractor):
14 _VALID_URL = r'https?://www\.ministrygrid.com/([^/?#]*/)*(?P<id>[^/#?]+)/?(?:$|[?#])'
17 'url': 'http://www.ministrygrid.com/training-viewer/-/training/t4g-2014-conference/the-gospel-by-numbers-4/the-gospel-by-numbers',
18 'md5': '844be0d2a1340422759c2a9101bab017',
20 'id': '3453494717001',
22 'title': 'The Gospel by Numbers',
23 'description': 'Coming soon from T4G 2014!',
24 'uploader': 'LifeWay Christian Resources (MG)',
28 def _real_extract(self, url):
29 mobj = re.match(self._VALID_URL, url)
30 video_id = mobj.group('id')
32 webpage = self._download_webpage(url, video_id)
33 portlets_json = self._search_regex(
34 r'Liferay\.Portlet\.list=(\[.+?\])', webpage, 'portlet list')
35 portlets = json.loads(portlets_json)
36 pl_id = self._search_regex(
37 r'<!--\s*p_l_id - ([0-9]+)<br>', webpage, 'p_l_id')
39 for i, portlet in enumerate(portlets):
40 portlet_url = 'http://www.ministrygrid.com/c/portal/render_portlet?p_l_id=%s&p_p_id=%s' % (pl_id, portlet)
41 portlet_code = self._download_webpage(
42 portlet_url, video_id,
43 note='Looking in portlet %s (%d/%d)' % (portlet, i + 1, len(portlets)),
45 video_iframe_url = self._search_regex(
46 r'<iframe.*?src="([^"]+)"', portlet_code, 'video iframe',
50 video_iframe_url, {'force_videoid': video_id})
57 raise ExtractorError('Could not find video iframe in any portlets')