]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ministrygrid.py
Import Upstream version 2020.01.24
[youtubedl] / youtube_dl / extractor / ministrygrid.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import (
5 ExtractorError,
6 smuggle_url,
7 )
8
9
10 class MinistryGridIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?ministrygrid\.com/([^/?#]*/)*(?P<id>[^/#?]+)/?(?:$|[?#])'
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',
20 'thumbnail': r're:^https?://.*\.jpg',
21 'upload_date': '20140410',
22 'description': 'Coming soon from T4G 2014!',
23 'uploader_id': '2034960640001',
24 'timestamp': 1397145591,
25 },
26 'params': {
27 # m3u8 download
28 'skip_download': True,
29 },
30 'add_ie': ['TDSLifeway'],
31 }
32
33 def _real_extract(self, url):
34 video_id = self._match_id(url)
35
36 webpage = self._download_webpage(url, video_id)
37 portlets = self._parse_json(self._search_regex(
38 r'Liferay\.Portlet\.list=(\[.+?\])', webpage, 'portlet list'),
39 video_id)
40 pl_id = self._search_regex(
41 r'getPlid:function\(\){return"(\d+)"}', webpage, 'p_l_id')
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:
53 return self.url_result(
54 smuggle_url(video_iframe_url, {'force_videoid': video_id}),
55 video_id=video_id)
56
57 raise ExtractorError('Could not find video iframe in any portlets')