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

Fix the antenna plugin to work with the updated site #1548

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
33 changes: 11 additions & 22 deletions src/livestreamer/plugins/antenna.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

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

_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>")
_url_re = re.compile("(http(s)?://(\w+\.)?antenna.gr)/minisites/[^/]+/watch/.+")
_playlist_re = re.compile("/Services/jwplayer/getplaylistJson.ashx\?mid=[^&]+&show=[^&]+")

class Antenna(Plugin):
@classmethod
Expand All @@ -17,33 +15,24 @@ def can_handle_url(self, url):

def _get_streams(self):

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

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

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

# Download playlist
# Download JSON playlist
res = http.get(playlist_url)

# Find manifest
match = _manifest_re.search(res.text)
manifest_url = match.group(1)
# Get URL of m3u8 playlist
res = json.loads(res.text)
res = res['url']

# 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
return HLSStream.parse_variant_playlist(self.session, res)

__plugin__ = Antenna