Created
October 14, 2012 01:44
-
-
Save ghthor/3886941 to your computer and use it in GitHub Desktop.
Own3d Stream Export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/python2 | |
| import re | |
| import sys | |
| import urllib | |
| import urllib2 | |
| from xml.dom.minidom import parseString | |
| def printRtmpdumpCommand(rtmpUrl, app, streamId, channel): | |
| print "rtmpdump -r \""+rtmpUrl+"\" -a \""+app+"\" -f \"WIN 11,1,102,62\" -W \"http://static.llnw.own3d.tv/player/Own3dPlayerV3_11.swf\" -p \"http://www.own3d.tv/live/"+streamId+"\" --live -y \""+channel+"\"" | |
| streamId=sys.argv[1] | |
| url = 'http://own3d.tv/livecfg/'+streamId; | |
| data = {'autoplay' : 'true'} | |
| urlEncodedData = urllib.urlencode(data) | |
| requestUrl = urllib2.Request(url, urlEncodedData) | |
| response = urllib2.urlopen(requestUrl) | |
| xml = response.read() | |
| response.close() | |
| livecfgDom = parseString(xml) | |
| streamsObject=livecfgDom.getElementsByTagName('channels')[0].getElementsByTagName('channel')[0].getElementsByTagName('clip')[0].getElementsByTagName('item')[0]; | |
| rtmpUrl = '' | |
| app = '' | |
| if re.match("rtmp://.*", streamsObject.getAttribute("base")): | |
| rtmpUrl = streamsObject.getAttribute("base") | |
| app = "own3duslive-live" | |
| elif streamsObject.getAttribute("base") == "${cdn2}": | |
| rtmpUrl = "rtmp://owned.fc.llnwd.net:1935/own3duslive-live" | |
| app = "owned" | |
| for currentStreamObject in streamsObject.childNodes: | |
| if currentStreamObject.nodeType != currentStreamObject.TEXT_NODE: | |
| printRtmpdumpCommand(rtmpUrl, | |
| app, | |
| streamId, | |
| currentStreamObject.getAttribute("name")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment