[Viafree] Fix extractor and extract subtitles (#828)

Authored by: coletdjnz
Fixes #820
This commit is contained in:
coletdjnz 2021-09-01 10:31:11 +12:00 committed by GitHub
parent 8eb7ba82ca
commit e88dabb35e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 12 deletions

View File

@ -34,8 +34,8 @@ class TVPlayIE(InfoExtractor):
tvplay(?:\.skaties)?\.lv(?:/parraides)?| tvplay(?:\.skaties)?\.lv(?:/parraides)?|
(?:tv3play|play\.tv3)\.lt(?:/programos)?| (?:tv3play|play\.tv3)\.lt(?:/programos)?|
tv3play(?:\.tv3)?\.ee/sisu| tv3play(?:\.tv3)?\.ee/sisu|
(?:tv(?:3|6|8|10)play|viafree)\.se/program| (?:tv(?:3|6|8|10)play)\.se/program|
(?:(?:tv3play|viasat4play|tv6play|viafree)\.no|(?:tv3play|viafree)\.dk)/programmer| (?:(?:tv3play|viasat4play|tv6play)\.no|(?:tv3play)\.dk)/programmer|
play\.nova(?:tv)?\.bg/programi play\.nova(?:tv)?\.bg/programi
) )
/(?:[^/]+/)+ /(?:[^/]+/)+
@ -223,10 +223,6 @@ class TVPlayIE(InfoExtractor):
'url': 'http://tv3play.tv3.ee/sisu/kodu-keset-linna/238551?autostart=true', 'url': 'http://tv3play.tv3.ee/sisu/kodu-keset-linna/238551?autostart=true',
'only_matching': True, 'only_matching': True,
}, },
{
'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
'only_matching': True,
},
{ {
'url': 'mtg:418113', 'url': 'mtg:418113',
'only_matching': True, 'only_matching': True,
@ -359,6 +355,23 @@ class ViafreeIE(InfoExtractor):
'params': { 'params': {
'skip_download': True, 'skip_download': True,
}, },
}, {
'url': 'https://www.viafree.dk/programmer/humor/comedy-central-roast-of-charlie-sheen/film/1047660',
'info_dict': {
'id': '1047660',
'ext': 'mp4',
'title': 'Comedy Central Roast of Charlie Sheen - Comedy Central Roast of Charlie Sheen',
'description': 'md5:ec956d941ae9fd7c65a48fd64951dc6d',
'series': 'Comedy Central Roast of Charlie Sheen',
'season_number': 1,
'duration': 3747,
'timestamp': 1608246060,
'upload_date': '20201217'
},
'params': {
'format': 'bestvideo',
'skip_download': True
}
}, { }, {
# with relatedClips # with relatedClips
'url': 'http://www.viafree.se/program/reality/sommaren-med-youtube-stjarnorna/sasong-1/avsnitt-1', 'url': 'http://www.viafree.se/program/reality/sommaren-med-youtube-stjarnorna/sasong-1/avsnitt-1',
@ -373,13 +386,12 @@ class ViafreeIE(InfoExtractor):
}, { }, {
'url': 'http://www.viafree.dk/programmer/reality/paradise-hotel/saeson-7/episode-5', 'url': 'http://www.viafree.dk/programmer/reality/paradise-hotel/saeson-7/episode-5',
'only_matching': True, 'only_matching': True,
}, {
'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
'only_matching': True,
}] }]
_GEO_BYPASS = False _GEO_BYPASS = False
@classmethod
def suitable(cls, url):
return False if TVPlayIE.suitable(url) else super(ViafreeIE, cls).suitable(url)
def _real_extract(self, url): def _real_extract(self, url):
country, path = self._match_valid_url(url).groups() country, path = self._match_valid_url(url).groups()
content = self._download_json( content = self._download_json(
@ -398,16 +410,16 @@ class ViafreeIE(InfoExtractor):
self.raise_geo_restricted(countries=[country]) self.raise_geo_restricted(countries=[country])
raise raise
formats = self._extract_m3u8_formats(stream_href, guid, 'mp4') formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4')
self._sort_formats(formats) self._sort_formats(formats)
episode = program.get('episode') or {} episode = program.get('episode') or {}
return { return {
'id': guid, 'id': guid,
'title': title, 'title': title,
'thumbnail': meta.get('image'), 'thumbnail': meta.get('image'),
'description': meta.get('description'), 'description': meta.get('description'),
'series': episode.get('seriesTitle'), 'series': episode.get('seriesTitle'),
'subtitles': subtitles,
'episode_number': int_or_none(episode.get('episodeNumber')), 'episode_number': int_or_none(episode.get('episodeNumber')),
'season_number': int_or_none(episode.get('seasonNumber')), 'season_number': int_or_none(episode.get('seasonNumber')),
'duration': int_or_none(try_get(program, lambda x: x['video']['duration']['milliseconds']), 1000), 'duration': int_or_none(try_get(program, lambda x: x['video']['duration']['milliseconds']), 1000),