2017-07-22 13:32:51 -06:00
|
|
|
from .common import InfoExtractor
|
2017-09-03 03:04:36 -06:00
|
|
|
from ..utils import (
|
|
|
|
float_or_none,
|
|
|
|
try_get,
|
|
|
|
)
|
2017-07-22 13:32:51 -06:00
|
|
|
|
|
|
|
|
|
|
|
class AliExpressLiveIE(InfoExtractor):
|
2017-09-03 03:04:36 -06:00
|
|
|
_VALID_URL = r'https?://live\.aliexpress\.com/live/(?P<id>\d+)'
|
2017-07-22 13:32:51 -06:00
|
|
|
_TEST = {
|
|
|
|
'url': 'https://live.aliexpress.com/live/2800002704436634',
|
2017-09-03 03:04:36 -06:00
|
|
|
'md5': 'e729e25d47c5e557f2630eaf99b740a5',
|
2017-07-22 13:32:51 -06:00
|
|
|
'info_dict': {
|
|
|
|
'id': '2800002704436634',
|
2017-09-03 03:04:36 -06:00
|
|
|
'ext': 'mp4',
|
2017-07-22 13:32:51 -06:00
|
|
|
'title': 'CASIMA7.22',
|
2022-03-04 10:01:04 -07:00
|
|
|
'thumbnail': r're:https?://.*\.jpg',
|
2017-07-22 13:32:51 -06:00
|
|
|
'uploader': 'CASIMA Official Store',
|
2017-09-03 03:04:36 -06:00
|
|
|
'timestamp': 1500717600,
|
|
|
|
'upload_date': '20170722',
|
2017-07-22 13:32:51 -06:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
2017-09-03 03:04:36 -06:00
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
|
|
|
data = self._parse_json(
|
|
|
|
self._search_regex(
|
|
|
|
r'(?s)runParams\s*=\s*({.+?})\s*;?\s*var',
|
|
|
|
webpage, 'runParams'),
|
|
|
|
video_id)
|
|
|
|
|
|
|
|
title = data['title']
|
|
|
|
|
|
|
|
formats = self._extract_m3u8_formats(
|
|
|
|
data['replyStreamUrl'], video_id, 'mp4',
|
|
|
|
entry_protocol='m3u8_native', m3u8_id='hls')
|
2017-07-22 13:32:51 -06:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
2017-09-03 03:04:36 -06:00
|
|
|
'title': title,
|
|
|
|
'thumbnail': data.get('coverUrl'),
|
|
|
|
'uploader': try_get(
|
2024-06-11 17:09:58 -06:00
|
|
|
data, lambda x: x['followBar']['name'], str),
|
2017-09-03 03:04:36 -06:00
|
|
|
'timestamp': float_or_none(data.get('startTimeLong'), scale=1000),
|
|
|
|
'formats': formats,
|
2017-07-22 13:32:51 -06:00
|
|
|
}
|