View Single Post
  #5  
Old 06-23-2009, 02:15 PM
matt7277 matt7277 is offline
Junior Member
 
Join Date: Jun 2009
Posts: 3
matt7277 is on a distinguished road
Default

Re: Flazr - open source RTMP stream saver


Were the def url and other variables taken from within a Wireshark capture as I have seen the basic scripts do? Would you be able to give any advice on making this reusable? Could an html page hypothetically be created to pass the url through and have the script auto generated?

Thanks in advance!
Matt

Quote:
Originally Posted by Stream Recorder View Post
Script for downloading from Yahoo Video with flazr
This is an example of how you can easily write a script to request an HTML page (or XML data in this case), parse the contents and extract the values needed to invoke the main RTMP client / download routine

Code:
import com.flazr.*

def videoId = "201620741"

def url = "http://video.music.yahoo.com/ver/268.0/process/getPlaylistFOP.php?node_id=v" \
        + videoId + "&tech=flash&bitrate=5000&eventid=1301797";             

def xml = Utils.getOverHttp(url)

println xml

def data = new XmlSlurper().parseText(xml)
def stream = data.'SEQUENCE-ITEM'[1].STREAM

def tcUrl = stream.@APP.text()
def host = stream.@SERVER.text()
def queryString = stream.@QUERYSTRING.text()
def path = stream.@PATH.text().substring(1)

def app = tcUrl.substring(tcUrl.lastIndexOf('/') + 1)
def playParam = path.substring(0, path.lastIndexOf('.')) + '?' + queryString

println 'queryString: ' + queryString + '\n'
println 'path: ' + path + '\n'
println 'playParam: ' + playParam + '\n'
println 'app: ' + app + '\n'

def session = new RtmpSession(host, 1935, app, playParam, 'test.flv')

RtmpClient.connect session
Reply With Quote