]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/malltv.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
16 class MallTVIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:(?:www|sk)\.)?mall\.tv/(?:[^/]+/)*(?P<id>[^/?#&]+)'
19 'url': 'https://www.mall.tv/18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice',
20 'md5': '1c4a37f080e1f3023103a7b43458e518',
23 'display_id': '18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice',
25 'title': '18 miliard pro neziskovky. Opravdu jsou sportovci nebo Člověk v tísni pijavice?',
26 'description': 'md5:db7d5744a4bd4043d9d98324aa72ab35',
28 'timestamp': 1538870400,
29 'upload_date': '20181007',
33 'url': 'https://www.mall.tv/kdo-to-plati/18-miliard-pro-neziskovky-opravdu-jsou-sportovci-nebo-clovek-v-tisni-pijavice',
34 'only_matching': True,
36 'url': 'https://sk.mall.tv/gejmhaus/reklamacia-nehreje-vyrobnik-tepla-alebo-spekacka',
37 'only_matching': True,
40 def _real_extract(self
, url
):
41 display_id
= self
._match
_id
(url
)
43 webpage
= self
._download
_webpage
(
44 url
, display_id
, headers
=self
.geo_verification_headers())
46 video
= self
._parse
_json
(self
._search
_regex
(
47 r
'videoObject\s*=\s*JSON\.parse\(JSON\.stringify\(({.+?})\)\);',
48 webpage
, 'video object'), display_id
)
49 video_source
= video
['VideoSource']
50 video_id
= self
._search
_regex
(
51 r
'/([\da-z]+)/index\b', video_source
, 'video id')
53 formats
= self
._extract
_m
3u8_formats
(
54 video_source
+ '.m3u8', video_id
, 'mp4', 'm3u8_native')
55 self
._sort
_formats
(formats
)
58 for s
in (video
.get('Subtitles') or {}):
62 subtitles
.setdefault(s
.get('Language') or 'cz', []).append({
66 entity_counts
= video
.get('EntityCounts') or {}
69 v
= entity_counts
.get(k
+ 's') or {}
70 return int_or_none(dict_get(v
, ('Count', 'StrCount')))
72 info
= self
._search
_json
_ld
(webpage
, video_id
, default
={})
76 'display_id': display_id
,
77 'title': video
.get('Title'),
78 'description': clean_html(video
.get('Description')),
79 'thumbnail': video
.get('ThumbnailUrl'),
81 'subtitles': subtitles
,
82 'duration': int_or_none(video
.get('DurationSeconds')) or parse_duration(video
.get('Duration')),
83 'view_count': get_count('View'),
84 'like_count': get_count('Like'),
85 'dislike_count': get_count('Dislike'),
86 'average_rating': float_or_none(try_get(video
, lambda x
: x
['EntityRating']['AvarageRate'])),
87 'comment_count': get_count('Comment'),