]>
Commit | Line | Data |
---|---|---|
2c4bba96 AG |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | from ..utils import ( | |
7 | parse_duration, | |
8 | js_to_json, | |
9 | ) | |
10 | ||
11 | ||
12 | class EUScreenIE(InfoExtractor): | |
73f035e1 | 13 | _VALID_URL = r'https?://(?:www\.)?euscreen\.eu/item.html\?id=(?P<id>[^&?$/]+)' |
2c4bba96 AG |
14 | |
15 | _TESTS = [{ | |
16 | 'url': 'https://euscreen.eu/item.html?id=EUS_0EBCBF356BFC4E12A014023BA41BD98C', | |
17 | 'info_dict': { | |
18 | 'id': 'EUS_0EBCBF356BFC4E12A014023BA41BD98C', | |
19 | 'ext': 'mp4', | |
20 | 'title': "L'effondrement du stade du Heysel", | |
21 | 'alt_title': 'Collapse of the Heysel Stadium', | |
22 | 'duration': 318.0, | |
23 | 'description': 'md5:f0ffffdfce6821139357a1b8359d6152', | |
24 | 'series': 'JA2 DERNIERE', | |
25 | 'episode': '-', | |
26 | 'uploader': 'INA / France', | |
27 | 'thumbnail': 'http://images3.noterik.com/domain/euscreenxl/user/eu_ina/video/EUS_0EBCBF356BFC4E12A014023BA41BD98C/image.jpg' | |
28 | }, | |
29 | 'params': {'skip_download': True} | |
30 | }] | |
31 | ||
32 | _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>' | |
33 | ||
34 | def _real_extract(self, url): | |
35 | id = self._match_id(url) | |
36 | args_for_js_request = self._download_webpage( | |
37 | 'https://euscreen.eu/lou/LouServlet/domain/euscreenxl/html5application/euscreenxlitem', | |
38 | id, data=self._payload, query={'actionlist': 'itempage', 'id': id}) | |
39 | info_js = self._download_webpage( | |
40 | 'https://euscreen.eu/lou/LouServlet/domain/euscreenxl/html5application/euscreenxlitem', | |
41 | id, data=args_for_js_request.replace('screenid', 'screenId').encode()) | |
42 | video_json = self._parse_json( | |
43 | self._search_regex(r'setVideo\(({.+})\)\(\$end\$\)put', info_js, 'Video JSON'), | |
44 | id, transform_source=js_to_json) | |
45 | meta_json = self._parse_json( | |
46 | self._search_regex(r'setData\(({.+})\)\(\$end\$\)', info_js, 'Metadata JSON'), | |
47 | id, transform_source=js_to_json) | |
48 | formats = [{ | |
49 | 'url': source['src'], | |
50 | } for source in video_json.get('sources', [])] | |
51 | self._sort_formats(formats) | |
52 | ||
53 | return { | |
54 | 'id': id, | |
55 | 'title': meta_json.get('originalTitle'), | |
56 | 'alt_title': meta_json.get('title'), | |
57 | 'duration': parse_duration(meta_json.get('duration')), | |
58 | 'description': '%s\n%s' % (meta_json.get('summaryOriginal', ''), meta_json.get('summaryEnglish', '')), | |
59 | 'series': meta_json.get('series') or meta_json.get('seriesEnglish'), | |
60 | 'episode': meta_json.get('episodeNumber'), | |
61 | 'uploader': meta_json.get('provider'), | |
62 | 'thumbnail': meta_json.get('screenshot') or video_json.get('screenshot'), | |
63 | 'formats': formats, | |
64 | } |