2 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from ..utils import ExtractorError
11 class OnDemandKoreaIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?P<id>[^/]+)\.html'
14 'url': 'http://www.ondemandkorea.com/ask-us-anything-e43.html',
16 'id': 'ask-us-anything-e43',
18 'title': 'Ask Us Anything : E43',
19 'thumbnail': 're:^https?://.*\.jpg$',
22 'skip_download': 'm3u8 download'
26 def _real_extract(self, url):
27 video_id = self._match_id(url)
28 webpage = self._download_webpage(url, video_id, fatal=False)
31 # Page sometimes returns captcha page with HTTP 403
32 raise ExtractorError('Unable to access page. You may have been blocked.', expected=True)
34 if 'msg_block_01.png' in webpage:
35 raise ExtractorError('This content is not available in your region.', expected=True)
37 if 'This video is only available to ODK PLUS members.' in webpage:
38 raise ExtractorError('This video is only available to ODK PLUS members.', expected=True)
40 title = self._og_search_title(webpage)
41 thumbnail = self._og_search_thumbnail(webpage)
43 manifest_url = self._search_regex(r'file:\s"(https?://[\S].+?/manifest\.m3u8)', webpage, 'manifest')
44 formats = self._extract_m3u8_formats(manifest_url, video_id, 'mp4', m3u8_id='hls')
45 self._sort_formats(formats)
47 subs = re.findall(r'file:\s\'(?P<file>[^\']+\.vtt)\',\s+label:\s+\'(?P<lang>[^\']+)\'', webpage)
50 subtitles[sub[1]] = [{'url': 'http://www.ondemandkorea.com' + sub[0], 'ext': sub[0][-3:]}]
55 'thumbnail': thumbnail,
57 'subtitles': subtitles,