Skip to content

Instantly share code, notes, and snippets.

@ghthor
Created October 14, 2012 01:44
Show Gist options
  • Select an option

  • Save ghthor/3886941 to your computer and use it in GitHub Desktop.

Select an option

Save ghthor/3886941 to your computer and use it in GitHub Desktop.
Own3d Stream Export
#! /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