[ondemandkorea] fix jw_config regex extraction; change title and description extraction (closes #23926)

This commit is contained in:
Julien Hadley Jack 2020-07-02 21:53:54 +02:00
parent 07af16b92e
commit efef17148f

View file

@ -11,18 +11,34 @@
class OnDemandKoreaIE(InfoExtractor): class OnDemandKoreaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?P<id>[^/]+)\.html' _VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?P<id>[^/]+)\.html'
_GEO_COUNTRIES = ['US', 'CA'] _GEO_COUNTRIES = ['US', 'CA']
_TEST = { _TESTS = [{
'url': 'http://www.ondemandkorea.com/ask-us-anything-e43.html', 'url': 'https://www.ondemandkorea.com/ask-us-anything-e43.html',
'info_dict': { 'info_dict': {
'id': 'ask-us-anything-e43', 'id': 'ask-us-anything-e43',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Ask Us Anything : E43', '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.”',
'thumbnail': r're:^https?://.*\.jpg$', 'thumbnail': r're:^https?://.*\.jpg$',
}, },
'params': { 'params': {
'skip_download': 'm3u8 download' 'skip_download': 'm3u8 download'
} }
} }, {
'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'
}
}]
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
@ -44,11 +60,13 @@ def _real_extract(self, url):
'This video is only available to ODK PLUS members.', 'This video is only available to ODK PLUS members.',
expected=True) expected=True)
title = self._og_search_title(webpage) title = self._search_regex(
r'class=["\']episode_title["\'][^>]*>([^<]+)',
webpage, 'episode_title', fatal=False) or self._og_search_title(webpage)
jw_config = self._parse_json( jw_config = self._parse_json(
self._search_regex( self._search_regex(
r'(?s)jwplayer\(([\'"])(?:(?!\1).)+\1\)\.setup\s*\((?P<options>.+?)\);', r'(?s)odkPlayer\.init.*?(?P<options>{[^;]+}).*?;',
webpage, 'jw config', group='options'), webpage, 'jw config', group='options'),
video_id, transform_source=js_to_json) video_id, transform_source=js_to_json)
info = self._parse_jwplayer_data( info = self._parse_jwplayer_data(
@ -57,6 +75,7 @@ def _real_extract(self, url):
info.update({ info.update({
'title': title, 'title': title,
'thumbnail': self._og_search_thumbnail(webpage), 'description': self._og_search_description(webpage),
'thumbnail': self._og_search_thumbnail(webpage)
}) })
return info return info