aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/tvplay.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-10-18 15:24:21 -0500
committerJesús <heckyel@hyperbola.info>2021-10-18 15:24:21 -0500
commit5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e (patch)
tree65209bc739db35e31f1c9b5b868eb5df4fe12ae3 /hypervideo_dl/extractor/tvplay.py
parent27fe903c511691c078942bef5ee9a05a43b15c8f (diff)
downloadhypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.tar.lz
hypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.tar.xz
hypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.zip
update from upstream
Diffstat (limited to 'hypervideo_dl/extractor/tvplay.py')
-rw-r--r--hypervideo_dl/extractor/tvplay.py48
1 files changed, 32 insertions, 16 deletions
diff --git a/hypervideo_dl/extractor/tvplay.py b/hypervideo_dl/extractor/tvplay.py
index 0d858c0..fbafb41 100644
--- a/hypervideo_dl/extractor/tvplay.py
+++ b/hypervideo_dl/extractor/tvplay.py
@@ -34,8 +34,8 @@ class TVPlayIE(InfoExtractor):
tvplay(?:\.skaties)?\.lv(?:/parraides)?|
(?:tv3play|play\.tv3)\.lt(?:/programos)?|
tv3play(?:\.tv3)?\.ee/sisu|
- (?:tv(?:3|6|8|10)play|viafree)\.se/program|
- (?:(?:tv3play|viasat4play|tv6play|viafree)\.no|(?:tv3play|viafree)\.dk)/programmer|
+ (?:tv(?:3|6|8|10)play)\.se/program|
+ (?:(?:tv3play|viasat4play|tv6play)\.no|(?:tv3play)\.dk)/programmer|
play\.nova(?:tv)?\.bg/programi
)
/(?:[^/]+/)+
@@ -224,10 +224,6 @@ class TVPlayIE(InfoExtractor):
'only_matching': True,
},
{
- 'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
- 'only_matching': True,
- },
- {
'url': 'mtg:418113',
'only_matching': True,
}
@@ -298,7 +294,8 @@ class TVPlayIE(InfoExtractor):
if not formats and video.get('is_geo_blocked'):
self.raise_geo_restricted(
- 'This content might not be available in your country due to copyright reasons')
+ 'This content might not be available in your country due to copyright reasons',
+ metadata_available=True)
self._sort_formats(formats)
@@ -339,8 +336,8 @@ class ViafreeIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:www\.)?
- viafree\.(?P<country>dk|no|se)
- /(?P<id>program(?:mer)?/(?:[^/]+/)+[^/?#&]+)
+ viafree\.(?P<country>dk|no|se|fi)
+ /(?P<id>(?:program(?:mer)?|ohjelmat)?/(?:[^/]+/)+[^/?#&]+)
'''
_TESTS = [{
'url': 'http://www.viafree.no/programmer/underholdning/det-beste-vorspielet/sesong-2/episode-1',
@@ -359,6 +356,23 @@ class ViafreeIE(InfoExtractor):
'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
'url': 'http://www.viafree.se/program/reality/sommaren-med-youtube-stjarnorna/sasong-1/avsnitt-1',
'only_matching': True,
@@ -372,15 +386,17 @@ class ViafreeIE(InfoExtractor):
}, {
'url': 'http://www.viafree.dk/programmer/reality/paradise-hotel/saeson-7/episode-5',
'only_matching': True,
+ }, {
+ 'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://www.viafree.fi/ohjelmat/entertainment/amazing-makeovers/kausi-7/jakso-2',
+ 'only_matching': True,
}]
_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):
- country, path = re.match(self._VALID_URL, url).groups()
+ country, path = self._match_valid_url(url).groups()
content = self._download_json(
'https://viafree-content.mtg-api.com/viafree-content/v1/%s/path/%s' % (country, path), path)
program = content['_embedded']['viafreeBlocks'][0]['_embedded']['program']
@@ -397,16 +413,16 @@ class ViafreeIE(InfoExtractor):
self.raise_geo_restricted(countries=[country])
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)
episode = program.get('episode') or {}
-
return {
'id': guid,
'title': title,
'thumbnail': meta.get('image'),
'description': meta.get('description'),
'series': episode.get('seriesTitle'),
+ 'subtitles': subtitles,
'episode_number': int_or_none(episode.get('episodeNumber')),
'season_number': int_or_none(episode.get('seasonNumber')),
'duration': int_or_none(try_get(program, lambda x: x['video']['duration']['milliseconds']), 1000),