[arte:+7] Detect more embeds (Closes #8613)

This commit is contained in:
Sergey M․ 2016-02-21 13:55:25 +06:00
parent b72f6163dc
commit 305168ca3e
1 changed files with 31 additions and 9 deletions

View File

@ -110,15 +110,25 @@ class ArteTVPlus7IE(InfoExtractor):
# en and es URLs produce react-based pages with different layout (e.g. # en and es URLs produce react-based pages with different layout (e.g.
# http://www.arte.tv/guide/en/053330-002-A/carnival-italy?zone=world) # http://www.arte.tv/guide/en/053330-002-A/carnival-italy?zone=world)
if not iframe_url: if not iframe_url:
embed_html = self._parse_json( program = self._search_regex(
self._search_regex( r'program\s*:\s*({.+?["\']embed_html["\'].+?}),?\s*\n',
r'program\s*:\s*({.+?["\']embed_html["\'].+?}),?\s*\n', webpage, 'program', default=None)
webpage, 'program'), if program:
video_id)['embed_html'] embed_html = self._parse_json(program,video_id)
iframe_url = find_iframe_url(embed_html) if embed_html:
json_url = compat_parse_qs( iframe_url = find_iframe_url(embed_html['embed_html'])
compat_urllib_parse_urlparse(iframe_url).query)['json_url'][0] if iframe_url:
return self._extract_from_json_url(json_url, video_id, lang) json_url = compat_parse_qs(
compat_urllib_parse_urlparse(iframe_url).query)['json_url'][0]
if json_url:
return self._extract_from_json_url(json_url, video_id, lang)
# Differend kind of embed URL (e.g.
# http://www.arte.tv/magazine/trepalium/fr/episode-0406-replay-trepalium)
embed_url = self._search_regex(
r'<iframe[^>]+src=(["\'])(?P<url>.+?)\1',
webpage, 'embed url', group='url')
return self.url_result(embed_url)
def _extract_from_json_url(self, json_url, video_id, lang): def _extract_from_json_url(self, json_url, video_id, lang):
info = self._download_json(json_url, video_id) info = self._download_json(json_url, video_id)
@ -294,6 +304,7 @@ class ArteTVMagazineIE(ArteTVPlus7IE):
_VALID_URL = r'https?://(?:www\.)?arte\.tv/magazine/[^/]+/(?P<lang>fr|de|en|es)/(?P<id>[^/?#&]+)' _VALID_URL = r'https?://(?:www\.)?arte\.tv/magazine/[^/]+/(?P<lang>fr|de|en|es)/(?P<id>[^/?#&]+)'
_TESTS = [{ _TESTS = [{
# Embedded via <iframe src="http://www.arte.tv/arte_vp/index.php?json_url=..."
'url': 'http://www.arte.tv/magazine/trepalium/fr/entretien-avec-le-realisateur-vincent-lannoo-trepalium', 'url': 'http://www.arte.tv/magazine/trepalium/fr/entretien-avec-le-realisateur-vincent-lannoo-trepalium',
'md5': '66a093339c1278bb3719157ef07107b2', 'md5': '66a093339c1278bb3719157ef07107b2',
'info_dict': { 'info_dict': {
@ -301,6 +312,17 @@ class ArteTVMagazineIE(ArteTVPlus7IE):
'ext': 'mp4', 'ext': 'mp4',
'title': 'Trepalium - Extrait Ep.01', 'title': 'Trepalium - Extrait Ep.01',
}, },
}, {
# Embedded via <iframe src="http://www.arte.tv/guide/fr/embed/054813-004-A/medium"
'url': 'http://www.arte.tv/magazine/trepalium/fr/episode-0406-replay-trepalium',
'md5': 'fedc64fc7a946110fe311634e79782ca',
'info_dict': {
'id': '054813-004_PLUS7-F',
'ext': 'mp4',
'title': 'Trepalium (4/6)',
'description': 'md5:10057003c34d54e95350be4f9b05cb40',
'upload_date': '20160218',
},
}, { }, {
'url': 'http://www.arte.tv/magazine/metropolis/de/frank-woeste-german-paris-metropolis', 'url': 'http://www.arte.tv/magazine/metropolis/de/frank-woeste-german-paris-metropolis',
'only_matching': True, 'only_matching': True,