]>
Commit | Line | Data |
---|---|---|
7a2e40dd AC |
1 | from .common import InfoExtractor |
2 | from ..utils import unescapeHTML | |
3 | ||
4 | ||
5 | class MirrorCoUKIE(InfoExtractor): | |
6 | _VALID_URL = r'https?://(?:www\.)?mirror\.co\.uk/[/+[\w-]+-(?P<id>\d+)' | |
7 | _TESTS = [{ | |
8 | 'url': 'https://www.mirror.co.uk/tv/tv-news/love-island-fans-baffled-after-27163139', | |
9 | 'info_dict': { | |
10 | 'id': 'voyyS7SV', | |
11 | 'ext': 'mp4', | |
12 | 'title': 'Love Island: Gemma Owen enters the villa', | |
13 | 'description': 'Love Island: Michael Owen\'s daughter Gemma Owen enters the villa.', | |
14 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/voyyS7SV/poster.jpg?width=720', | |
15 | 'display_id': '27163139', | |
16 | 'timestamp': 1654547895, | |
17 | 'duration': 57.0, | |
18 | 'upload_date': '20220606', | |
19 | }, | |
20 | }, { | |
21 | 'url': 'https://www.mirror.co.uk/3am/celebrity-news/michael-jacksons-son-blankets-new-25344890', | |
22 | 'info_dict': { | |
23 | 'id': 'jyXpdvxp', | |
24 | 'ext': 'mp4', | |
25 | 'title': 'Michael Jackson’s son Bigi calls for action on climate change', | |
26 | 'description': 'md5:d39ceaba2b7a615b4ca6557e7bc40222', | |
27 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/jyXpdvxp/poster.jpg?width=720', | |
28 | 'display_id': '25344890', | |
29 | 'timestamp': 1635749907, | |
30 | 'duration': 56.0, | |
31 | 'upload_date': '20211101', | |
32 | }, | |
33 | }, { | |
34 | 'url': 'https://www.mirror.co.uk/sport/football/news/antonio-conte-next-tottenham-manager-25346042', | |
35 | 'info_dict': { | |
36 | 'id': 'q6FkKa4p', | |
37 | 'ext': 'mp4', | |
38 | 'title': 'Nuno sacked by Tottenham after fifth Premier League defeat of the season', | |
39 | 'description': 'Nuno Espirito Santo has been sacked as Tottenham boss after only four months in charge.', | |
40 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/q6FkKa4p/poster.jpg?width=720', | |
41 | 'display_id': '25346042', | |
42 | 'timestamp': 1635763157, | |
43 | 'duration': 40.0, | |
44 | 'upload_date': '20211101', | |
45 | }, | |
46 | }, { | |
47 | 'url': 'https://www.mirror.co.uk/3am/celebrity-news/johnny-depp-splashes-50k-curry-27160737', | |
48 | 'info_dict': { | |
49 | 'id': 'IT0oa1nH', | |
50 | 'ext': 'mp4', | |
51 | 'title': 'Johnny Depp Leaves The Grand Hotel in Birmingham', | |
52 | 'description': 'Johnny Depp Leaves The Grand Hotel in Birmingham.', | |
53 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/IT0oa1nH/poster.jpg?width=720', | |
54 | 'display_id': '27160737', | |
55 | 'timestamp': 1654524120, | |
56 | 'duration': 65.0, | |
57 | 'upload_date': '20220606', | |
58 | }, | |
59 | }, { | |
60 | 'url': 'https://www.mirror.co.uk/tv/tv-news/love-islands-liam-could-first-27162602', | |
61 | 'info_dict': { | |
62 | 'id': 'EaPr5Z2j', | |
63 | 'ext': 'mp4', | |
64 | 'title': 'Love Island: Davide reveals plot twist after receiving text', | |
65 | 'description': 'Love Island: Davide reveals plot twist after receiving text', | |
66 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/EaPr5Z2j/poster.jpg?width=720', | |
67 | 'display_id': '27162602', | |
68 | 'timestamp': 1654552597, | |
69 | 'duration': 23.0, | |
70 | 'upload_date': '20220606', | |
71 | }, | |
72 | }, { | |
73 | 'url': 'https://www.mirror.co.uk/news/uk-news/william-kate-sent-message-george-27160572', | |
74 | 'info_dict': { | |
75 | 'id': 'ygtceXIu', | |
76 | 'ext': 'mp4', | |
77 | 'title': 'Prince William and Kate arrive in Wales with George and Charlotte', | |
78 | 'description': 'Prince William and Kate Middleton arrive in Wales with children Prince George and Princess Charlotte.', | |
79 | 'thumbnail': 'https://cdn.jwplayer.com/v2/media/ygtceXIu/poster.jpg?width=720', | |
80 | 'display_id': '27160572', | |
81 | 'timestamp': 1654349678, | |
82 | 'duration': 106.0, | |
83 | 'upload_date': '20220604', | |
84 | }, | |
85 | }] | |
86 | ||
87 | def _real_extract(self, url): | |
88 | display_id = self._match_id(url) | |
89 | webpage = self._download_webpage(url, display_id) | |
90 | data = self._search_json(r'div\s+class="json-placeholder"\s+data-json="', | |
91 | webpage, 'data', display_id, transform_source=unescapeHTML)['videoData'] | |
92 | ||
93 | return { | |
94 | '_type': 'url_transparent', | |
95 | 'url': f'jwplatform:{data["videoId"]}', | |
96 | 'ie_key': 'JWPlatform', | |
97 | 'display_id': display_id, | |
98 | } |