[yahoo] Add support for custom brigthcove embeds (closes #14210)
This commit is contained in:
parent
3600fd591d
commit
eb9a15be60
1 changed files with 26 additions and 3 deletions
|
@ -28,7 +28,7 @@ from .nbc import NBCSportsVPlayerIE
|
|||
|
||||
class YahooIE(InfoExtractor):
|
||||
IE_DESC = 'Yahoo screen and movies'
|
||||
_VALID_URL = r'(?P<url>(?P<host>https?://(?:[a-zA-Z]{2}\.)?[\da-zA-Z_-]+\.yahoo\.com)/(?:[^/]+/)*(?P<display_id>.+)?-(?P<id>[0-9]+)(?:-[a-z]+)?(?:\.html)?)'
|
||||
_VALID_URL = r'(?P<host>https?://(?:[a-zA-Z]{2}\.)?[\da-zA-Z_-]+\.yahoo\.com)/(?:[^/]+/)*(?:(?P<display_id>.+)?-)?(?P<id>[0-9]+)(?:-[a-z]+)?(?:\.html)?'
|
||||
_TESTS = [
|
||||
{
|
||||
'url': 'http://screen.yahoo.com/julian-smith-travis-legg-watch-214727115.html',
|
||||
|
@ -227,13 +227,28 @@ class YahooIE(InfoExtractor):
|
|||
'skip_download': True,
|
||||
},
|
||||
},
|
||||
{
|
||||
# custom brightcove
|
||||
'url': 'https://au.tv.yahoo.com/plus7/sunrise/-/watch/37083565/clown-entertainers-say-it-is-hurting-their-business/',
|
||||
'info_dict': {
|
||||
'id': '5575377707001',
|
||||
'ext': 'mp4',
|
||||
'title': "Clown entertainers say 'It' is hurting their business",
|
||||
'description': 'Stephen King s horror film has much to answer for. Jelby and Mr Loopy the Clowns join us.',
|
||||
'timestamp': 1505341164,
|
||||
'upload_date': '20170913',
|
||||
'uploader_id': '2376984109001',
|
||||
},
|
||||
'params': {
|
||||
'skip_download': True,
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
display_id = mobj.group('display_id') or self._match_id(url)
|
||||
page_id = mobj.group('id')
|
||||
url = mobj.group('url')
|
||||
display_id = mobj.group('display_id') or page_id
|
||||
host = mobj.group('host')
|
||||
webpage, urlh = self._download_webpage_handle(url, display_id)
|
||||
if 'err=404' in urlh.geturl():
|
||||
|
@ -262,6 +277,14 @@ class YahooIE(InfoExtractor):
|
|||
if bc_url:
|
||||
return self.url_result(bc_url, BrightcoveNewIE.ie_key())
|
||||
|
||||
brightcove_id = self._search_regex(
|
||||
r'<iframe[^>]+data-video-id=["\'](\d+)', webpage, 'brightcove id',
|
||||
default=None)
|
||||
if brightcove_id:
|
||||
return self.url_result(
|
||||
'http://players.brightcove.net/2376984109001/default_default/index.html?videoId=%s' % brightcove_id,
|
||||
BrightcoveNewIE.ie_key())
|
||||
|
||||
# Query result is often embedded in webpage as JSON. Sometimes explicit requests
|
||||
# to video API results in a failure with geo restriction reason therefore using
|
||||
# embedded query result when present sounds reasonable.
|
||||
|
|
Loading…
Reference in a new issue