parent
503115540d
commit
23b2df82c7
|
@ -1,40 +1,53 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import try_get, float_or_none
|
|
||||||
from ..compat import compat_str
|
from ..compat import compat_str
|
||||||
|
from ..utils import (
|
||||||
|
float_or_none,
|
||||||
|
try_get,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AliExpressLiveIE(InfoExtractor):
|
class AliExpressLiveIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://live\.aliexpress\.com/live/(?P<id>\d+)'
|
||||||
_VALID_URL = r'https?://live\.aliexpress\.com/live/(?P<id>[0-9]{16})'
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://live.aliexpress.com/live/2800002704436634',
|
'url': 'https://live.aliexpress.com/live/2800002704436634',
|
||||||
'md5': '7ac2bc46afdd18f0b45a0a340fc47ffe',
|
'md5': 'e729e25d47c5e557f2630eaf99b740a5',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2800002704436634',
|
'id': '2800002704436634',
|
||||||
'ext': 'm3u8',
|
'ext': 'mp4',
|
||||||
'title': 'CASIMA7.22',
|
'title': 'CASIMA7.22',
|
||||||
|
'thumbnail': r're:http://.*\.jpg',
|
||||||
'uploader': 'CASIMA Official Store',
|
'uploader': 'CASIMA Official Store',
|
||||||
'upload_date': '20170714',
|
'timestamp': 1500717600,
|
||||||
'timestamp': 1500027138,
|
'upload_date': '20170722',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
page = self._download_webpage(url, video_id)
|
|
||||||
run_params_json = self._search_regex(r'runParams = (.+)[\s+]var myCtl', page, 'runParams', flags=re.DOTALL)
|
webpage = self._download_webpage(url, video_id)
|
||||||
run_params = self._parse_json(run_params_json, 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')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': run_params['title'],
|
'title': title,
|
||||||
'url': run_params['replyStreamUrl'],
|
'thumbnail': data.get('coverUrl'),
|
||||||
'uploader': try_get(run_params, lambda x: x['followBar']['name'], compat_str),
|
'uploader': try_get(
|
||||||
'timestamp': float_or_none(try_get(run_params, lambda x: x['followBar']['createTime']) / 1000),
|
data, lambda x: x['followBar']['name'], compat_str),
|
||||||
|
'timestamp': float_or_none(data.get('startTimeLong'), scale=1000),
|
||||||
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue