mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-23 20:23:05 +08:00
additional info and better regexes
This commit is contained in:
parent
4bcc6c372f
commit
53b12fac9d
@ -2,6 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import parse_duration
|
||||
|
||||
|
||||
class MallTVIE(InfoExtractor):
|
||||
@ -22,7 +23,7 @@ class MallTVIE(InfoExtractor):
|
||||
'nimi nakládá. Objem dotací pro neziskovky '
|
||||
'roste, ale opravdu jsou tyto organizace '
|
||||
'„pijavice", jak o nich hovoří And')
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
'url': ('https://www.mall.tv/kdo-to-plati/18-miliard-pro-neziskovky'
|
||||
@ -46,22 +47,29 @@ class MallTVIE(InfoExtractor):
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
self.report_extraction(video_id)
|
||||
JSON_LD_RE = (r'(?is)<script[^>]+type=([\"\'])?application/ld\+json>.*'
|
||||
'(?P<json_ld>{.+}).*</script>')
|
||||
json_ld = self._search_regex(JSON_LD_RE, webpage, 'JSON_LD',
|
||||
group='json_ld')
|
||||
if not json_ld:
|
||||
info = {}
|
||||
else:
|
||||
info = self._json_ld(json_ld, video_id)
|
||||
|
||||
format_url = self._html_search_regex(
|
||||
r'<source src=(.+index)\s',
|
||||
r'<source src=([\"\'])?(.+index)\s',
|
||||
webpage,
|
||||
'm3u8 URL')
|
||||
formats = self._extract_m3u8_formats(format_url+'.m3u8',
|
||||
video_id, 'mp4')
|
||||
self._sort_formats(formats)
|
||||
|
||||
title = info.get('title', self._og_search_title(webpage, fatal=False))
|
||||
thumbnail = info.get('thumbnailUrl', self._og_search_thumbnail(webpage))
|
||||
return {
|
||||
'id': video_id,
|
||||
'title': self._og_search_title(webpage),
|
||||
'thumbnail': self._og_search_thumbnail(webpage),
|
||||
'title': title,
|
||||
'thumbnail': thumbnail,
|
||||
'description': self._og_search_description(webpage),
|
||||
'title': self._og_search_title(webpage),
|
||||
'duration': parse_duration(info.get('duration')),
|
||||
'formats': formats
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user