From b7717e24be7edfa1fc21a07bb7044f97dc6b9119 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 23 Aug 2018 23:50:38 -0700 Subject: [PATCH] [olympicchannel] Add extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/olympicchannel.py | 43 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 youtube_dl/extractor/olympicchannel.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index a8b89bcde..07f9aa2f1 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -792,6 +792,7 @@ from .nzz import NZZIE from .odatv import OdaTVIE from .odnoklassniki import OdnoklassnikiIE from .oktoberfesttv import OktoberfestTVIE +from .olympicchannel import OlympicChannelIE from .ondemandkorea import OnDemandKoreaIE from .onet import ( OnetIE, diff --git a/youtube_dl/extractor/olympicchannel.py b/youtube_dl/extractor/olympicchannel.py new file mode 100644 index 000000000..8ee9249cd --- /dev/null +++ b/youtube_dl/extractor/olympicchannel.py @@ -0,0 +1,43 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, unified_strdate + + +class OlympicChannelIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?olympicchannel\.com/../video/detail/(?P[^/]+)' + _TEST = { + 'url': 'https://www.olympicchannel.com/en/video/detail/men-s-halfpipe-finals-snowboard-pyeongchang-2018-replays/', + 'info_dict': { + 'id': '1789cf09-7143-4972-b822-16210fa1a4b1', + 'ext': 'mp4', + 'title': 'Men\'s Halfpipe Finals - Snowboard | PyeongChang 2018 Replays', + 'description': 'The men\'s halfpipe finals were held at the Phoenix Snow Park on 14 February 2018.', + 'release_date': '20180308', + 'thumbnail': r're:^https?://.*', + } + } + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + + video_id = self._html_search_meta('episode_uid', webpage) + title = self._html_search_meta('episode_title', webpage) + formats = self._extract_m3u8_formats(self._html_search_meta('video_url', webpage), video_id, 'mp4') + description = self._html_search_meta('episode_synopsis', webpage, fatal=False) + release_date = unified_strdate(self._html_search_meta('content_release_date_local_utc', webpage, fatal=False)) + thumbnail = self._og_search_thumbnail(webpage) + + self._sort_formats(formats) + + return { + 'id': video_id, + 'display_id': display_id, + 'title': title, + 'formats': formats, + 'description': description, + 'release_date': release_date, + 'thumbnail': thumbnail, + }