aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--src/livestreamer/plugins/__init__.py2
-rw-r--r--src/livestreamer/plugins/ongamenet.py57
3 files changed, 59 insertions, 1 deletions
diff --git a/README.md b/README.md
index 34d85c8..0724e2e 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ Currently supported sites are:
* GOMTV.net
* Justin.tv/Twitch.tv
+* Ongamenet
* Own3d.tv
* SVTPlay
* UStream
diff --git a/src/livestreamer/plugins/__init__.py b/src/livestreamer/plugins/__init__.py
index b0cdbb5..d6861c9 100644
--- a/src/livestreamer/plugins/__init__.py
+++ b/src/livestreamer/plugins/__init__.py
@@ -34,7 +34,7 @@ class Plugin(object):
to be of highest quality.
"""
- ranking = ["iphonelow", "iphonehigh", "240p", "320k", "360p", "SQTest", "SQ", "850k",
+ ranking = ["iphonelow", "iphonehigh", "240p", "320k", "360p", "sd", "SQTest", "SQ", "850k",
"480p", "HQTest", "HQ", "1400k", "720p", "2400k", "hd", "1080p", "live"]
streams = self._get_streams()
for rank in reversed(ranking):
diff --git a/src/livestreamer/plugins/ongamenet.py b/src/livestreamer/plugins/ongamenet.py
new file mode 100644
index 0000000..0267c84
--- /dev/null
+++ b/src/livestreamer/plugins/ongamenet.py
@@ -0,0 +1,57 @@
+from livestreamer.compat import str, bytes
+from livestreamer.plugins import Plugin, PluginError, NoStreamsError
+from livestreamer.stream import RTMPStream
+from livestreamer.utils import urlget
+
+import re
+
+class Ongamenet(Plugin):
+ PlayerURL = "http://www.ongamenet.com/front/ongame/live/vodPlayerHD.jsp"
+ SWFURL = "http://www.ongamenet.com/front/ongame/live/CJPlayer.swf"
+ PageURL = "http://www.ongamenet.com"
+ Streams = {
+ "high": "hd",
+ "low": "sd"
+ }
+
+ @classmethod
+ def can_handle_url(self, url):
+ return "ongamenet.com" in url
+
+ def _get_play_url(self, var):
+ res = urlget(self.PlayerURL)
+
+ stream = None
+ server = None
+
+ streams = re.findall(('var {0}Stream = "(.+)"\;\r\n').format(var), res.text)
+ servers = re.findall(('var {0}Server = "(.+)"\;\r\n').format(var), res.text)
+
+ if streams and len(streams) >= 2:
+ stream = streams[1]
+
+ if servers and len(servers) >= 1:
+ server = servers[0]
+
+ return (server, stream)
+
+ def _get_streams(self):
+ streams = {}
+
+ for var, name in self.Streams.items():
+ server, stream = self._get_play_url(var)
+
+ if not (stream and server):
+ continue
+
+ streams[name] = RTMPStream(self.session, {
+ "rtmp": server,
+ "playpath": stream,
+ "swfUrl": self.SWFURL,
+ "pageUrl": self.PageURL,
+ "live": True,
+ })
+
+ return streams
+
+__plugin__ = Ongamenet