2018-10-11 05:47:21 +08:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2018-10-11 07:14:35 +08:00
|
|
|
from ..utils import parse_duration
|
2018-10-11 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
class MallTVIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?mall\.tv/(?:.+/)?(?P<id>.+)'
|
|
|
|
_TESTS = [
|
|
|
|
{
|
2019-01-06 23:07:33 +08:00
|
|
|
'url': ('https://www.mall.tv/18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice'),
|
2018-10-11 05:47:21 +08:00
|
|
|
'info_dict': {
|
2019-01-06 23:07:33 +08:00
|
|
|
'id': ('18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice'),
|
2018-10-11 05:47:21 +08:00
|
|
|
'ext': 'mp4',
|
2019-01-06 23:07:33 +08:00
|
|
|
'title': ('18 miliard pro neziskovky. Opravdu jsou sportovci nebo Člověk v tísni pijavice?'),
|
2018-10-11 05:47:21 +08:00
|
|
|
'description': ('Pokud někdo hospodaří s penězmi daňových '
|
|
|
|
'poplatníků, pak logicky chceme vědět, jak s '
|
|
|
|
'nimi nakládá. Objem dotací pro neziskovky '
|
|
|
|
'roste, ale opravdu jsou tyto organizace '
|
|
|
|
'„pijavice", jak o nich hovoří And')
|
2018-10-11 07:14:35 +08:00
|
|
|
},
|
2018-10-11 05:47:21 +08:00
|
|
|
'params': {
|
|
|
|
'skip_download': True
|
|
|
|
}
|
2018-10-11 05:47:21 +08:00
|
|
|
},
|
|
|
|
{
|
2019-01-06 23:07:33 +08:00
|
|
|
'url': ('https://www.mall.tv/kdo-to-plati/18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice'),
|
2018-10-11 05:47:21 +08:00
|
|
|
'info_dict': {
|
2019-01-06 23:07:33 +08:00
|
|
|
'id': ('18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice'),
|
2018-10-11 05:47:21 +08:00
|
|
|
'ext': 'mp4',
|
2019-01-06 23:07:33 +08:00
|
|
|
'title': ('18 miliard pro neziskovky. Opravdu jsou sportovci nebo Člověk v tísni pijavice?'),
|
2018-10-11 05:47:21 +08:00
|
|
|
'description': ('Pokud někdo hospodaří s penězmi daňových '
|
|
|
|
'poplatníků, pak logicky chceme vědět, jak s '
|
|
|
|
'nimi nakládá. Objem dotací pro neziskovky '
|
|
|
|
'roste, ale opravdu jsou tyto organizace '
|
|
|
|
'„pijavice", jak o nich hovoří And')
|
2018-10-11 05:47:21 +08:00
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'skip_download': True
|
|
|
|
}
|
2018-10-11 05:47:21 +08:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2018-10-11 05:47:21 +08:00
|
|
|
info = self._search_json_ld(webpage, video_id, default={})
|
2018-10-11 05:47:21 +08:00
|
|
|
|
|
|
|
format_url = self._html_search_regex(
|
2018-10-11 05:47:21 +08:00
|
|
|
r'<source src=([\"\'])?(?P<src>.+?index)\1?[^>]*?>',
|
|
|
|
webpage, 'm3u8 URL', group='src')
|
2018-10-11 05:47:21 +08:00
|
|
|
formats = self._extract_m3u8_formats(format_url+'.m3u8',
|
|
|
|
video_id, 'mp4')
|
|
|
|
self._sort_formats(formats)
|
2018-10-11 07:14:35 +08:00
|
|
|
title = info.get('title', self._og_search_title(webpage, fatal=False))
|
|
|
|
thumbnail = info.get('thumbnailUrl', self._og_search_thumbnail(webpage))
|
2018-10-11 05:47:21 +08:00
|
|
|
return {
|
|
|
|
'id': video_id,
|
2018-10-11 07:14:35 +08:00
|
|
|
'title': title,
|
|
|
|
'thumbnail': thumbnail,
|
2018-10-11 05:47:21 +08:00
|
|
|
'description': self._og_search_description(webpage),
|
2018-10-11 07:14:35 +08:00
|
|
|
'duration': parse_duration(info.get('duration')),
|
2018-10-11 05:47:21 +08:00
|
|
|
'formats': formats
|
|
|
|
}
|