mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
8 years ago
|
# coding: utf-8
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
from .common import InfoExtractor
|
||
|
from ..compat import compat_str
|
||
7 years ago
|
from ..utils import (
|
||
|
float_or_none,
|
||
|
try_get,
|
||
|
)
|
||
8 years ago
|
|
||
|
|
||
|
class AliExpressLiveIE(InfoExtractor):
|
||
7 years ago
|
_VALID_URL = r'https?://live\.aliexpress\.com/live/(?P<id>\d+)'
|
||
8 years ago
|
_TEST = {
|
||
|
'url': 'https://live.aliexpress.com/live/2800002704436634',
|
||
7 years ago
|
'md5': 'e729e25d47c5e557f2630eaf99b740a5',
|
||
8 years ago
|
'info_dict': {
|
||
|
'id': '2800002704436634',
|
||
7 years ago
|
'ext': 'mp4',
|
||
8 years ago
|
'title': 'CASIMA7.22',
|
||
7 years ago
|
'thumbnail': r're:http://.*\.jpg',
|
||
8 years ago
|
'uploader': 'CASIMA Official Store',
|
||
7 years ago
|
'timestamp': 1500717600,
|
||
|
'upload_date': '20170722',
|
||
8 years ago
|
},
|
||
|
}
|
||
|
|
||
|
def _real_extract(self, url):
|
||
|
video_id = self._match_id(url)
|
||
7 years ago
|
|
||
|
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')
|
||
8 years ago
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
7 years ago
|
'title': title,
|
||
|
'thumbnail': data.get('coverUrl'),
|
||
|
'uploader': try_get(
|
||
|
data, lambda x: x['followBar']['name'], compat_str),
|
||
|
'timestamp': float_or_none(data.get('startTimeLong'), scale=1000),
|
||
|
'formats': formats,
|
||
8 years ago
|
}
|