From efef17148f57d09de038e1b5e2f5a6f38dddcad8 Mon Sep 17 00:00:00 2001 From: Julien Hadley Jack Date: Thu, 2 Jul 2020 21:53:54 +0200 Subject: [PATCH 1/2] [ondemandkorea] fix jw_config regex extraction; change title and description extraction (closes #23926) --- youtube_dl/extractor/ondemandkorea.py | 33 +++++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/ondemandkorea.py b/youtube_dl/extractor/ondemandkorea.py index df1ce3c1db..37e09bd182 100644 --- a/youtube_dl/extractor/ondemandkorea.py +++ b/youtube_dl/extractor/ondemandkorea.py @@ -11,18 +11,34 @@ from ..utils import ( class OnDemandKoreaIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?P[^/]+)\.html' _GEO_COUNTRIES = ['US', 'CA'] - _TEST = { - 'url': 'http://www.ondemandkorea.com/ask-us-anything-e43.html', + _TESTS = [{ + 'url': 'https://www.ondemandkorea.com/ask-us-anything-e43.html', 'info_dict': { 'id': 'ask-us-anything-e43', '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$', }, 'params': { '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): video_id = self._match_id(url) @@ -44,11 +60,13 @@ class OnDemandKoreaIE(InfoExtractor): 'This video is only available to ODK PLUS members.', 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( self._search_regex( - r'(?s)jwplayer\(([\'"])(?:(?!\1).)+\1\)\.setup\s*\((?P.+?)\);', + r'(?s)odkPlayer\.init.*?(?P{[^;]+}).*?;', webpage, 'jw config', group='options'), video_id, transform_source=js_to_json) info = self._parse_jwplayer_data( @@ -57,6 +75,7 @@ class OnDemandKoreaIE(InfoExtractor): info.update({ 'title': title, - 'thumbnail': self._og_search_thumbnail(webpage), + 'description': self._og_search_description(webpage), + 'thumbnail': self._og_search_thumbnail(webpage) }) return info From abb41d6430eb525cdbe526d47ed072aee270a7f9 Mon Sep 17 00:00:00 2001 From: Julien Hadley Jack Date: Sun, 2 Aug 2020 20:59:18 +0200 Subject: [PATCH 2/2] [ondemandkorea] add extractor error for odk premium content --- youtube_dl/extractor/ondemandkorea.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/youtube_dl/extractor/ondemandkorea.py b/youtube_dl/extractor/ondemandkorea.py index 37e09bd182..cc3c587bc4 100644 --- a/youtube_dl/extractor/ondemandkorea.py +++ b/youtube_dl/extractor/ondemandkorea.py @@ -60,6 +60,11 @@ class OnDemandKoreaIE(InfoExtractor): 'This video is only available to ODK PLUS members.', expected=True) + if 'ODK PREMIUM Members Only' in webpage: + raise ExtractorError( + 'This video is only available to ODK PREMIUM members.', + expected=True) + title = self._search_regex( r'class=["\']episode_title["\'][^>]*>([^<]+)', webpage, 'episode_title', fatal=False) or self._og_search_title(webpage)