This commit is contained in:
xela722 2020-10-21 15:55:43 +02:00 committed by GitHub
commit 31f82d3d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -786,6 +786,7 @@ from .nzz import NZZIE
from .odatv import OdaTVIE from .odatv import OdaTVIE
from .odnoklassniki import OdnoklassnikiIE from .odnoklassniki import OdnoklassnikiIE
from .oktoberfesttv import OktoberfestTVIE from .oktoberfesttv import OktoberfestTVIE
from .olympicchannel import OlympicChannelIE
from .ondemandkorea import OnDemandKoreaIE from .ondemandkorea import OnDemandKoreaIE
from .onet import ( from .onet import (
OnetIE, OnetIE,

View File

@ -0,0 +1,42 @@
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class OlympicChannelIE(InfoExtractor):
_VALID_URL = r"http(?:s)?://(\w+)\.?olympicchannel.com/../video/detail/(?P<id>.*)/"
_TEST = {
'url': 'https://www.olympicchannel.com/en/video/detail/women-s-downhill-2-fis-world-cup-lake-louise/',
'info_dict': {
'id': 'women-s-downhill-2-fis-world-cup-lake-louise',
'ext': 'mp4',
'title': "Women's Downhill 2 | FIS World Cup - Lake Louise | Olympic Channel",
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
# TODO more code goes here, for example ...
title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
baseUrl = self._html_search_regex(r'meta name="video_url" content="(.*?)"', webpage, 'baseUrl')
domainUrl = re.search(r'(http(?:s)?://.*?)/', baseUrl).group(0)
url = self._download_webpage("https://www.olympicchannel.com/OcsTokenization/api/v1/tokenizedUrl?url=%s&domain=%s" % (baseUrl, domainUrl), video_id)
formats = []
formats.extend(self._extract_m3u8_formats(url.replace('"', ''), video_id, ext='mp4'))
return {
'id': video_id,
'title': title,
'formats': formats
}