[allocine] Fix for /video/ videos (closes #10860)
parent
65f4c1de3d
commit
176006a120
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
remove_end,
|
||||||
qualities,
|
qualities,
|
||||||
url_basename,
|
url_basename,
|
||||||
)
|
)
|
||||||
|
@ -46,7 +47,14 @@ class AllocineIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.allocine.fr/video/video-19550147/',
|
'url': 'http://www.allocine.fr/video/video-19550147/',
|
||||||
'only_matching': True,
|
'md5': '3566c0668c0235e2d224fd8edb389f67',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19550147',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Faux Raccord N°123 - Les gaffes de Cliffhanger',
|
||||||
|
'description': 'md5:bc734b83ffa2d8a12188d9eb48bb6354',
|
||||||
|
'thumbnail': 're:http://.*\.jpg',
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -54,26 +62,48 @@ class AllocineIE(InfoExtractor):
|
||||||
|
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
model = self._html_search_regex(
|
formats = []
|
||||||
r'data-model="([^"]+)"', webpage, 'data model')
|
|
||||||
model_data = self._parse_json(model, display_id)
|
|
||||||
|
|
||||||
quality = qualities(['ld', 'md', 'hd'])
|
quality = qualities(['ld', 'md', 'hd'])
|
||||||
|
|
||||||
formats = []
|
model = self._html_search_regex(
|
||||||
for video_url in model_data['sources'].values():
|
r'data-model="([^"]+)"', webpage, 'data model', default=None)
|
||||||
video_id, format_id = url_basename(video_url).split('_')[:2]
|
if model:
|
||||||
formats.append({
|
model_data = self._parse_json(model, display_id)
|
||||||
'format_id': format_id,
|
|
||||||
'quality': quality(format_id),
|
for video_url in model_data['sources'].values():
|
||||||
'url': video_url,
|
video_id, format_id = url_basename(video_url).split('_')[:2]
|
||||||
})
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'quality': quality(format_id),
|
||||||
|
'url': video_url,
|
||||||
|
})
|
||||||
|
|
||||||
|
title = model_data['title']
|
||||||
|
else:
|
||||||
|
video_id = display_id
|
||||||
|
media_data = self._download_json(
|
||||||
|
'http://www.allocine.fr/ws/AcVisiondataV5.ashx?media=%s' % video_id, display_id)
|
||||||
|
for key, value in media_data['video'].items():
|
||||||
|
if not key.endswith('Path'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
format_id = key[:-len('Path')]
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'quality': quality(format_id),
|
||||||
|
'url': value,
|
||||||
|
})
|
||||||
|
|
||||||
|
title = remove_end(self._html_search_regex(
|
||||||
|
r'(?s)<title>(.+?)</title>', webpage, 'title'
|
||||||
|
).strip(), ' - AlloCiné')
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': model_data['title'],
|
'title': title,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
|
|
Loading…
Reference in New Issue