mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.1 KiB
Python
87 lines
3.1 KiB
Python
8 years ago
|
# coding: utf-8
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
8 years ago
|
from .common import InfoExtractor
|
||
8 years ago
|
from ..utils import (
|
||
|
ExtractorError,
|
||
|
js_to_json,
|
||
|
)
|
||
8 years ago
|
|
||
|
|
||
8 years ago
|
class OnDemandKoreaIE(InfoExtractor):
|
||
8 years ago
|
_VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?P<id>[^/]+)\.html'
|
||
8 years ago
|
_GEO_COUNTRIES = ['US', 'CA']
|
||
5 years ago
|
_TESTS = [{
|
||
|
'url': 'https://www.ondemandkorea.com/ask-us-anything-e43.html',
|
||
8 years ago
|
'info_dict': {
|
||
|
'id': 'ask-us-anything-e43',
|
||
|
'ext': 'mp4',
|
||
5 years ago
|
'title': 'Ask Us Anything : Gain, Ji Soo - 09/24/2016',
|
||
|
'description': 'A talk show/game show with a school theme where celebrity guests appear as “transfer students.”',
|
||
8 years ago
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||
8 years ago
|
},
|
||
|
'params': {
|
||
|
'skip_download': 'm3u8 download'
|
||
|
}
|
||
5 years ago
|
}, {
|
||
|
'url': 'https://www.ondemandkorea.com/confession-e01-1.html',
|
||
|
'info_dict': {
|
||
|
'id': 'confession-e01-1',
|
||
|
'ext': 'mp4',
|
||
|
'title': 'Confession : E01',
|
||
|
'description': 'Choi Do-hyun, a criminal attorney, is the son of a death row convict. Ever since Choi Pil-su got arrested for murder, Do-hyun has wanted to solve his ',
|
||
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||
|
'subtitles': {
|
||
|
'English': 'mincount:1',
|
||
|
},
|
||
|
},
|
||
|
'params': {
|
||
|
'skip_download': 'm3u8 download'
|
||
|
}
|
||
|
}]
|
||
8 years ago
|
|
||
|
def _real_extract(self, url):
|
||
|
video_id = self._match_id(url)
|
||
|
webpage = self._download_webpage(url, video_id, fatal=False)
|
||
|
|
||
|
if not webpage:
|
||
|
# Page sometimes returns captcha page with HTTP 403
|
||
8 years ago
|
raise ExtractorError(
|
||
|
'Unable to access page. You may have been blocked.',
|
||
|
expected=True)
|
||
8 years ago
|
|
||
|
if 'msg_block_01.png' in webpage:
|
||
8 years ago
|
self.raise_geo_restricted(
|
||
8 years ago
|
msg='This content is not available in your region',
|
||
8 years ago
|
countries=self._GEO_COUNTRIES)
|
||
8 years ago
|
|
||
8 years ago
|
if 'This video is only available to ODK PLUS members.' in webpage:
|
||
8 years ago
|
raise ExtractorError(
|
||
|
'This video is only available to ODK PLUS members.',
|
||
|
expected=True)
|
||
8 years ago
|
|
||
4 years ago
|
if 'ODK PREMIUM Members Only' in webpage:
|
||
|
raise ExtractorError(
|
||
|
'This video is only available to ODK PREMIUM members.',
|
||
|
expected=True)
|
||
|
|
||
5 years ago
|
title = self._search_regex(
|
||
|
r'class=["\']episode_title["\'][^>]*>([^<]+)',
|
||
|
webpage, 'episode_title', fatal=False) or self._og_search_title(webpage)
|
||
8 years ago
|
|
||
8 years ago
|
jw_config = self._parse_json(
|
||
|
self._search_regex(
|
||
5 years ago
|
r'(?s)odkPlayer\.init.*?(?P<options>{[^;]+}).*?;',
|
||
8 years ago
|
webpage, 'jw config', group='options'),
|
||
|
video_id, transform_source=js_to_json)
|
||
|
info = self._parse_jwplayer_data(
|
||
|
jw_config, video_id, require_title=False, m3u8_id='hls',
|
||
|
base_url=url)
|
||
8 years ago
|
|
||
8 years ago
|
info.update({
|
||
8 years ago
|
'title': title,
|
||
5 years ago
|
'description': self._og_search_description(webpage),
|
||
|
'thumbnail': self._og_search_thumbnail(webpage)
|
||
8 years ago
|
})
|
||
|
return info
|