From eb4284a94bf6dce3aec31ce3016ee0816e5b2080 Mon Sep 17 00:00:00 2001 From: dubber0 Date: Sat, 22 Jul 2017 21:32:51 +0200 Subject: [PATCH] [aliexpress] Add new extractor --- youtube_dl/extractor/aliexpress.py | 36 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 37 insertions(+) create mode 100644 youtube_dl/extractor/aliexpress.py diff --git a/youtube_dl/extractor/aliexpress.py b/youtube_dl/extractor/aliexpress.py new file mode 100644 index 000000000..810b9b9fb --- /dev/null +++ b/youtube_dl/extractor/aliexpress.py @@ -0,0 +1,36 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import unified_strdate +from datetime import datetime + +class AliExpressLiveIE(InfoExtractor): + _VALID_URL = r'https?://live\.aliexpress\.com/live/(?P[0-9]{16})' + _TEST = [{ + 'url': 'https://live.aliexpress.com/live/2800002704436634', + 'info_dict': { + 'id': '2800002704436634', + 'ext': 'm3u8', + 'title': 'CASIMA7.22', + 'uploader': 'CASIMA Official Store', + 'upload_date': '20170714', + 'is_live': True, + }, + 'params': { + 'skip_download': True, + } + }] + + def _real_extract(self, url): + page = self._download_webpage(url, self._match_id(url)) + upload_date = self._html_search_regex(r'"createTime":([0-9]{10})[0-9]{3},', page, 'upload_date') + + return { + 'id': str(self._match_id(url)), + 'title': self._html_search_regex(r'"title": "([^"]+)"', page, 'url'), + 'url': self._html_search_regex(r'"replyStreamUrl": "([^"]+)"', page, 'url'), + 'uploader': self._html_search_regex(r'"name":"([^"]+)"', page, 'uploader'), + 'upload_date': datetime.fromtimestamp(int(upload_date)).strftime('%Y%m%d'), + 'is_live': True, + } diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index db7616caa..08a7ea926 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -45,6 +45,7 @@ from .anvato import AnvatoIE from .anysex import AnySexIE from .aol import AolIE from .allocine import AllocineIE +from .aliexpress import AliExpressLiveIE from .aparat import AparatIE from .appleconnect import AppleConnectIE from .appletrailers import (