mirror of https://github.com/blackjack4494/yt-dlc
[skysport] add support ooyala embed_token protected videos(fixes #14641)
This commit is contained in:
parent
b0f4331002
commit
44cca168cc
|
@ -2,7 +2,12 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import strip_or_none
|
from ..utils import (
|
||||||
|
extract_attributes,
|
||||||
|
smuggle_url,
|
||||||
|
strip_or_none,
|
||||||
|
urljoin,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SkySportsIE(InfoExtractor):
|
class SkySportsIE(InfoExtractor):
|
||||||
|
@ -22,12 +27,22 @@ class SkySportsIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
video_data = extract_attributes(self._search_regex(
|
||||||
|
r'(<div.+?class="sdc-article-video__media-ooyala"[^>]+>)', webpage, 'video data'))
|
||||||
|
|
||||||
|
video_url = 'ooyala:%s' % video_data['data-video-id']
|
||||||
|
if video_data.get('data-token-required') == 'true':
|
||||||
|
token_fetch_options = self._parse_json(video_data.get('data-token-fetch-options', '{}'), video_id, fatal=False) or {}
|
||||||
|
token_fetch_url = token_fetch_options.get('url')
|
||||||
|
if token_fetch_url:
|
||||||
|
embed_token = self._download_webpage(urljoin(url, token_fetch_url), video_id, fatal=False)
|
||||||
|
if embed_token:
|
||||||
|
video_url = smuggle_url(video_url, {'embed_token': embed_token.strip('"')})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': 'ooyala:%s' % self._search_regex(
|
'url': video_url,
|
||||||
r'data-video-id="([^"]+)"', webpage, 'ooyala id'),
|
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'description': strip_or_none(self._og_search_description(webpage)),
|
'description': strip_or_none(self._og_search_description(webpage)),
|
||||||
'ie_key': 'Ooyala',
|
'ie_key': 'Ooyala',
|
||||||
|
|
Loading…
Reference in New Issue