Skip to content

Commit

Permalink
Add antenna.gr plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlos256 committed Nov 24, 2015
1 parent 8dd6a69 commit c360f99
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/livestreamer/plugins/antenna.py
@@ -0,0 +1,49 @@
import re
import json

from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import HDSStream

_url_re = re.compile("(http(s)?://(\w+\.)?antenna.gr)/webtv/watch\?cid=.+")
_playlist_re = re.compile("playlist:\s*\"(/templates/data/jplayer\?cid=[^\"]+)")
_manifest_re = re.compile("jwplayer:source\s+file=\"([^\"]+)\"")
_swf_re = re.compile("<jwplayer:provider>(http[^<]+)</jwplayer:provider>")

class Antenna(Plugin):
@classmethod
def can_handle_url(self, url):
return _url_re.match(url)

def _get_streams(self):

# Discover root
match = _url_re.search(self.url)
root = match.group(1)

# Download main URL
res = http.get(self.url)

# Find playlist
match = _playlist_re.search(res.text)
playlist_url = root + match.group(1) + "d"

# Download playlist
res = http.get(playlist_url)

# Find manifest
match = _manifest_re.search(res.text)
manifest_url = match.group(1)

# Find SWF
match = _swf_re.search(res.text)
swf_url = match.group(1);

streams = {}
streams.update(
HDSStream.parse_manifest(self.session, manifest_url, pvswf=swf_url)
)

return streams

__plugin__ = Antenna

0 comments on commit c360f99

Please sign in to comment.