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

TVCatchup.com Plugin #775

Merged
merged 5 commits into from
Mar 7, 2015
Merged
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 @@ -67,6 +67,7 @@ tga - star.plu.cn Yes No
tv4play - tv4play.se Yes Yes Streams may be geo-restricted to Sweden.
Only non-premium streams currently supported.
- fotbollskanalen.se
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are breaking up the tv4play entry here, the fotbollskanalen.se line should be directly under the tv4play lines.

tvcatchup - tvcatchup.com Yes No Streams may be geo-restricted to Great Britain.
twitch twitch.tv Yes Yes Possible to authenticate for access to
subscription streams.
ustreamtv ustream.tv Yes Yes
Expand Down
33 changes: 33 additions & 0 deletions src/livestreamer/plugins/tvcatchup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import re

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

SUCCESS_HTTP_CODES = (200,)

STREAM_URL_FORMAT = "http://tvcatchup.com/stream.php?chan={0}"
_url_re = re.compile("http://(?:www\.)?tvcatchup.com/watch/(?P<channel_id>[0-9]+)")


class TVCatchup(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)

def _get_streams(self):
"""
Finds the stream from tvcatchup, they only provide a single 480p stream per channel.
"""
match = _url_re.match(self.url).groupdict()
channel_id = match["channel_id"]

res = http.get(STREAM_URL_FORMAT.format(channel_id))

stream_url = http.json(res).get('url')

if stream_url:
return {"480p": HLSStream(self.session, stream_url)}


__plugin__ = TVCatchup