Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mediaklikk.hu stream and video support #1253

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/plugin_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ livestream new.livestream.com Yes --
livecoding livecoding.tv Yes --
media_ccc_de - media.ccc.de Yes Yes Only mp4 and HLS are supported.
- streaming... [4]_
mediaklikk mediaklikk.hu Yes No Streams may be geo-restricted to Hungary.
meerkat meerkatapp.co Yes --
mips mips.tv Yes -- Requires rtmpdump with K-S-V patches.
mlgtv mlg.tv Yes --
Expand Down
40 changes: 40 additions & 0 deletions src/livestreamer/plugins/mediaklikk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import re

from livestreamer.plugin import Plugin
from livestreamer.stream import HLSStream
from livestreamer.plugin.api import http


_stream_url_re = re.compile(r"http(s)?://(www\.)?mediaklikk.hu/([A-Za-z0-9\-]+)/?")
_id_re = re.compile(r'.*data\-streamid="([a-z0-9]+)".*')
_file_re = re.compile(r'.*{\'file\': ?\'([a-zA-Z0-9\./\?=:]+)\'}].*')

_stream_player_url = "http://player.mediaklikk.hu/player/player-inside-full3.php?userid=mtva&streamid={0}&flashmajor=21&flashminor=0"


class Mediaklikk(Plugin):
@classmethod
def can_handle_url(cls, url):
return _stream_url_re.match(url)

def _get_playlist_url(self):
# get the id
content = http.get(self.url)
match = _id_re.match(content.text.replace("\n", ""))
if not match:
return

# get the m3u8 file url
player_url = _stream_player_url.format(match.group(1))
content = http.get(player_url)

match = _file_re.match(content.text.replace("\n", ""))
if match:
return match.group(1)

def _get_streams(self):
playlist = self._get_playlist_url()
return HLSStream.parse_variant_playlist(self.session, playlist)


__plugin__ = Mediaklikk