1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

[ministrygrid] Fix extraction and modernize

This commit is contained in:
Yen Chi Hsuan 2016-04-15 02:47:07 +08:00
parent e1bf277e19
commit 8cb57bab8e
No known key found for this signature in database
GPG Key ID: 3FDDD575826C5C30

View File

@ -1,8 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
@ -20,21 +17,22 @@ class MinistryGridIE(InfoExtractor):
'id': '3453494717001', 'id': '3453494717001',
'ext': 'mp4', 'ext': 'mp4',
'title': 'The Gospel by Numbers', 'title': 'The Gospel by Numbers',
'description': 'Coming soon from T4G 2014!', },
'uploader': 'LifeWay Christian Resources (MG)', 'params': {
# m3u8 download
'skip_download': True,
}, },
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) video_id = self._match_id(url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
portlets_json = self._search_regex( portlets = self._parse_json(self._search_regex(
r'Liferay\.Portlet\.list=(\[.+?\])', webpage, 'portlet list') r'Liferay\.Portlet\.list=(\[.+?\])', webpage, 'portlet list'),
portlets = json.loads(portlets_json) video_id)
pl_id = self._search_regex( pl_id = self._search_regex(
r'<!--\s*p_l_id - ([0-9]+)<br>', webpage, 'p_l_id') r'getPlid:function\(\){return"(\d+)"}', webpage, 'p_l_id')
for i, portlet in enumerate(portlets): for i, portlet in enumerate(portlets):
portlet_url = 'http://www.ministrygrid.com/c/portal/render_portlet?p_l_id=%s&p_p_id=%s' % (pl_id, portlet) portlet_url = 'http://www.ministrygrid.com/c/portal/render_portlet?p_l_id=%s&p_p_id=%s' % (pl_id, portlet)
@ -46,12 +44,8 @@ def _real_extract(self, url):
r'<iframe.*?src="([^"]+)"', portlet_code, 'video iframe', r'<iframe.*?src="([^"]+)"', portlet_code, 'video iframe',
default=None) default=None)
if video_iframe_url: if video_iframe_url:
surl = smuggle_url( return self.url_result(
video_iframe_url, {'force_videoid': video_id}) smuggle_url(video_iframe_url, {'force_videoid': video_id}),
return { video_id=video_id)
'_type': 'url',
'id': video_id,
'url': surl,
}
raise ExtractorError('Could not find video iframe in any portlets') raise ExtractorError('Could not find video iframe in any portlets')