1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 10:24:33 +01:00

[mediaklikk] initial

This commit is contained in:
mrx23dot 2020-05-02 14:18:23 +01:00
parent 27d8e089a2
commit 5a3e2d571d
2 changed files with 58 additions and 0 deletions

View File

@ -607,6 +607,7 @@ from .markiza import (
from .massengeschmacktv import MassengeschmackTVIE
from .matchtv import MatchTVIE
from .mdr import MDRIE
from .mediaklikk import MediaKlikkIE
from .mediaset import MediasetIE
from .mediasite import MediasiteIE
from .medici import MediciIE

View File

@ -0,0 +1,57 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_unquote,
compat_str
)
class MediaKlikkIE(InfoExtractor):
# (?P<name>...) used for referencing match as 'id'
_VALID_URL = r'https?://(?:www\.)?mediaklikk\.hu/video/(?P<id>:[^/]+)/?'
_TEST = {
'url': 'https://mediaklikk.hu/video/kiberma-2020-04-30-i-adas/',
'info_dict': {
'id': '2512015',
'ext': 'mp4',
'title': 'KiberMa, 2020.04.30-i adás | MédiaKlikk',
# no thumbnail extractable
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
display_id = video_id
webpage = self._download_webpage(url, video_id)
pattern = r"mtva_player_manager\.player\(document.getElementById\(.*\),\s?(\{.*\}).*\);"
info_json = self._html_search_regex(pattern, webpage, 'info_json')
info_meta = self._parse_json(compat_urllib_parse_unquote(info_json),None)
info_ret = {
'_type': 'video',
'title': info_meta.get('title') or self._og_search_title(webpage),
'ext': 'mp4',
'display_id': display_id,
'id': video_id
}
if 'series' in info_meta:
info_ret['series'] = info_meta['series']
info_meta['video'] = info_meta['token']
del info_meta['token']
playerpage = self._download_webpage('https://player.mediaklikk.hu/playernew/player.php',
video_id,
query=info_meta)
pattern = r"\"file\": \"(\\/\\/.*playlist\.m3u8)\","
playlist_url = 'https:' + compat_urllib_parse_unquote(
self._html_search_regex(pattern, playerpage, 'playlist_url'))\
.replace('\\/', '/')
formats = self._extract_wowza_formats(
playlist_url, video_id, skip_protocols=['f4m', 'smil', 'dash'])
self._sort_formats(formats)
info_ret['formats'] = formats
return info_ret