]>
Commit | Line | Data |
---|---|---|
50311554 | 1 | from .common import InfoExtractor |
23b2df82 S |
2 | from ..utils import ( |
3 | float_or_none, | |
4 | try_get, | |
5 | ) | |
50311554 | 6 | |
7 | ||
8 | class AliExpressLiveIE(InfoExtractor): | |
23b2df82 | 9 | _VALID_URL = r'https?://live\.aliexpress\.com/live/(?P<id>\d+)' |
50311554 | 10 | _TEST = { |
11 | 'url': 'https://live.aliexpress.com/live/2800002704436634', | |
23b2df82 | 12 | 'md5': 'e729e25d47c5e557f2630eaf99b740a5', |
50311554 | 13 | 'info_dict': { |
14 | 'id': '2800002704436634', | |
23b2df82 | 15 | 'ext': 'mp4', |
50311554 | 16 | 'title': 'CASIMA7.22', |
50e93e03 | 17 | 'thumbnail': r're:https?://.*\.jpg', |
50311554 | 18 | 'uploader': 'CASIMA Official Store', |
23b2df82 S |
19 | 'timestamp': 1500717600, |
20 | 'upload_date': '20170722', | |
50311554 | 21 | }, |
22 | } | |
23 | ||
24 | def _real_extract(self, url): | |
25 | video_id = self._match_id(url) | |
23b2df82 S |
26 | |
27 | webpage = self._download_webpage(url, video_id) | |
28 | ||
29 | data = self._parse_json( | |
30 | self._search_regex( | |
31 | r'(?s)runParams\s*=\s*({.+?})\s*;?\s*var', | |
32 | webpage, 'runParams'), | |
33 | video_id) | |
34 | ||
35 | title = data['title'] | |
36 | ||
37 | formats = self._extract_m3u8_formats( | |
38 | data['replyStreamUrl'], video_id, 'mp4', | |
39 | entry_protocol='m3u8_native', m3u8_id='hls') | |
50311554 | 40 | |
41 | return { | |
42 | 'id': video_id, | |
23b2df82 S |
43 | 'title': title, |
44 | 'thumbnail': data.get('coverUrl'), | |
45 | 'uploader': try_get( | |
add96eb9 | 46 | data, lambda x: x['followBar']['name'], str), |
23b2df82 S |
47 | 'timestamp': float_or_none(data.get('startTimeLong'), scale=1000), |
48 | 'formats': formats, | |
50311554 | 49 | } |