[arte.tv:+7] Fix extraction (fixes #8427)

This commit is contained in:
Jaime Marquínez Ferrándiz 2016-02-04 20:16:47 +01:00
parent f1ed3acae5
commit 3f7e8750d4
1 changed files with 13 additions and 3 deletions

View File

@ -13,6 +13,7 @@ from ..utils import (
unified_strdate, unified_strdate,
get_element_by_attribute, get_element_by_attribute,
int_or_none, int_or_none,
NO_DEFAULT,
qualities, qualities,
) )
@ -93,9 +94,18 @@ class ArteTVPlus7IE(InfoExtractor):
json_url = self._html_search_regex( json_url = self._html_search_regex(
patterns, webpage, 'json vp url', default=None) patterns, webpage, 'json vp url', default=None)
if not json_url: if not json_url:
iframe_url = self._html_search_regex( def find_iframe_url(webpage, default=NO_DEFAULT):
r'<iframe[^>]+src=(["\'])(?P<url>.+\bjson_url=.+?)\1', return self._html_search_regex(
webpage, 'iframe url', group='url') r'<iframe[^>]+src=(["\'])(?P<url>.+\bjson_url=.+?)\1',
webpage, 'iframe url', group='url', default=default)
iframe_url = find_iframe_url(webpage, None)
if not iframe_url:
embed_url = self._html_search_regex(
r'arte_vp_url_oembed=\'([^\']+?)\'', webpage, 'embed url')
player = self._download_json(
embed_url, video_id, 'Downloading player page')
iframe_url = find_iframe_url(player['html'])
json_url = compat_parse_qs( json_url = compat_parse_qs(
compat_urllib_parse_urlparse(iframe_url).query)['json_url'][0] compat_urllib_parse_urlparse(iframe_url).query)['json_url'][0]
return self._extract_from_json_url(json_url, video_id, lang) return self._extract_from_json_url(json_url, video_id, lang)