2021-10-11 00:06:27 +02:00
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
|
|
|
js_to_json,
|
2024-05-26 21:27:21 +02:00
|
|
|
parse_duration,
|
2021-10-11 00:06:27 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class EUScreenIE(InfoExtractor):
|
2021-11-30 17:14:47 +01:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?euscreen\.eu/item.html\?id=(?P<id>[^&?$/]+)'
|
2021-10-11 00:06:27 +02:00
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://euscreen.eu/item.html?id=EUS_0EBCBF356BFC4E12A014023BA41BD98C',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'EUS_0EBCBF356BFC4E12A014023BA41BD98C',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': "L'effondrement du stade du Heysel",
|
|
|
|
'alt_title': 'Collapse of the Heysel Stadium',
|
|
|
|
'duration': 318.0,
|
|
|
|
'description': 'md5:f0ffffdfce6821139357a1b8359d6152',
|
|
|
|
'series': 'JA2 DERNIERE',
|
|
|
|
'episode': '-',
|
|
|
|
'uploader': 'INA / France',
|
2024-06-12 01:09:58 +02:00
|
|
|
'thumbnail': 'http://images3.noterik.com/domain/euscreenxl/user/eu_ina/video/EUS_0EBCBF356BFC4E12A014023BA41BD98C/image.jpg',
|
2021-10-11 00:06:27 +02:00
|
|
|
},
|
2024-06-12 01:09:58 +02:00
|
|
|
'params': {'skip_download': True},
|
2021-10-11 00:06:27 +02:00
|
|
|
}]
|
|
|
|
|
|
|
|
_payload = b'<fsxml><screen><properties><screenId>-1</screenId></properties><capabilities id="1"><properties><platform>Win32</platform><appcodename>Mozilla</appcodename><appname>Netscape</appname><appversion>5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36</appversion><useragent>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36</useragent><cookiesenabled>true</cookiesenabled><screenwidth>784</screenwidth><screenheight>758</screenheight><orientation>undefined</orientation><smt_browserid>Sat, 07 Oct 2021 08:56:50 GMT</smt_browserid><smt_sessionid>1633769810758</smt_sessionid></properties></capabilities></screen></fsxml>'
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2024-06-12 01:09:58 +02:00
|
|
|
video_id = self._match_id(url)
|
2021-10-11 00:06:27 +02:00
|
|
|
args_for_js_request = self._download_webpage(
|
|
|
|
'https://euscreen.eu/lou/LouServlet/domain/euscreenxl/html5application/euscreenxlitem',
|
2024-06-12 01:09:58 +02:00
|
|
|
video_id, data=self._payload, query={'actionlist': 'itempage', 'id': video_id})
|
2021-10-11 00:06:27 +02:00
|
|
|
info_js = self._download_webpage(
|
|
|
|
'https://euscreen.eu/lou/LouServlet/domain/euscreenxl/html5application/euscreenxlitem',
|
2024-06-12 01:09:58 +02:00
|
|
|
video_id, data=args_for_js_request.replace('screenid', 'screenId').encode())
|
2021-10-11 00:06:27 +02:00
|
|
|
video_json = self._parse_json(
|
|
|
|
self._search_regex(r'setVideo\(({.+})\)\(\$end\$\)put', info_js, 'Video JSON'),
|
2024-06-12 01:09:58 +02:00
|
|
|
video_id, transform_source=js_to_json)
|
2021-10-11 00:06:27 +02:00
|
|
|
meta_json = self._parse_json(
|
|
|
|
self._search_regex(r'setData\(({.+})\)\(\$end\$\)', info_js, 'Metadata JSON'),
|
2024-06-12 01:09:58 +02:00
|
|
|
video_id, transform_source=js_to_json)
|
2021-10-11 00:06:27 +02:00
|
|
|
formats = [{
|
|
|
|
'url': source['src'],
|
|
|
|
} for source in video_json.get('sources', [])]
|
|
|
|
|
|
|
|
return {
|
2024-06-12 01:09:58 +02:00
|
|
|
'id': video_id,
|
2021-10-11 00:06:27 +02:00
|
|
|
'title': meta_json.get('originalTitle'),
|
|
|
|
'alt_title': meta_json.get('title'),
|
|
|
|
'duration': parse_duration(meta_json.get('duration')),
|
2024-06-12 01:09:58 +02:00
|
|
|
'description': '{}\n{}'.format(meta_json.get('summaryOriginal', ''), meta_json.get('summaryEnglish', '')),
|
2021-10-11 00:06:27 +02:00
|
|
|
'series': meta_json.get('series') or meta_json.get('seriesEnglish'),
|
|
|
|
'episode': meta_json.get('episodeNumber'),
|
|
|
|
'uploader': meta_json.get('provider'),
|
|
|
|
'thumbnail': meta_json.get('screenshot') or video_json.get('screenshot'),
|
|
|
|
'formats': formats,
|
|
|
|
}
|