1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 08:34:32 +01:00

[tv2] Add support for mtvuutiset.fi

This commit is contained in:
Teemu Ikonen 2020-09-21 21:05:51 +03:00
parent b55715934b
commit d406d9c8e1
2 changed files with 37 additions and 1 deletions

View File

@ -1185,6 +1185,7 @@ from .tv2 import (
TV2IE,
TV2ArticleIE,
KatsomoIE,
MTVuutisetIE,
)
from .tv2dk import (
TV2DKIE,

View File

@ -38,8 +38,11 @@ class TV2IE(InfoExtractor):
_PROTOCOLS = ('HDS', 'HLS', 'DASH')
_GEO_COUNTRIES = ['NO']
def get_id(self, url):
return self._match_id(url)
def _real_extract(self, url):
video_id = self._match_id(url)
video_id = self.get_id(url)
api_base = 'http://%s/api/web/asset/%s' % (self._API_DOMAIN, video_id)
formats = []
@ -190,3 +193,35 @@ class KatsomoIE(TV2IE):
_API_DOMAIN = 'api.katsomo.fi'
_PROTOCOLS = ('HLS', 'MPD')
_GEO_COUNTRIES = ['FI']
class MTVuutisetIE(TV2IE):
_VALID_URL = r'https?://(?:www\.)mtvuutiset\.fi/(?:artikkeli/[0-9a-z-]+/|video/prog)(?P<id>\d+)'
_TEST = {
'url': 'https://www.mtvuutiset.fi/artikkeli/tallaisia-vaurioita-viking-amorellassa-on-useamman-osaston-alla-vetta/7931384',
'info_dict': {
'id': '1311159',
'ext': 'mp4',
'title': 'MTV Uutiset Live',
'description': 'Viking Amorellan matkustajien evakuointi on alkanut tältä operaatio näyttää laivalla',
'timestamp': 1600608966,
'upload_date': '20200920',
'duration': 153.7886666,
'view_count': int,
'categories': list,
},
'params': {
# m3u8 download
'skip_download': True,
},
}
_API_DOMAIN = 'api.katsomo.fi'
_PROTOCOLS = ('HLS', 'MPD')
_GEO_COUNTRIES = ['FI']
def get_id(self, url):
art_id = self._match_id(url)
webpage = self._download_webpage(url, art_id)
video_id = self._html_search_regex(
r'<div class=\'player-container\' .*data-katsomoid="(.+?)"', webpage, 'video_id')
return video_id