Hi,
I can successfully grab a token with the following routine, but the resulting rtmp url will not play in ffplay.
Not sure if I missed something and I don't have the time to sniff the wire for the actual rtmp command sent by the browser, or compare my ffplay command with the probing command sent by Serviio, but this may be a start for jhb50 to work out a patch. Maybe the rtmp server expects a referer of some kind? (The server script which provided the token did).
- Code:
def jsonMatcher = linkHtml =~ 'getJSON\\("(.+?)"'
if (jsonMatcher != null && jsonMatcher.size() > 0)
{
def strJsonURL = jsonMatcher[0][1]
//println 'strJsonURL: ' + strJsonURL
// http://www.streamlive.to/server2.php?id=1417601839
// This is probably not needed, but if you need to refresh the token then you may use this as the id-parameter to the strJsonURL:
def strEpoch = (new Date()).getTime().toString().substring(0,10)
strJsonURL = strJsonURL + '&_=' + strEpoch
def jsonURL = new URL(strJsonURL)
def jsonConnection = jsonURL.openConnection()
jsonConnection.addRequestProperty("Referer", linkUrl);
jsonConnection.connect();
def strJson = jsonConnection.content.text
//println strJson
def tokenMatcher = strJson =~ '":"(.+?)"'
if (tokenMatcher != null && tokenMatcher.size() > 0)
{
token = tokenMatcher[0][1]
//println 'token: ' + token
}
}
rtmpUrl = secMatcher[0][2].trim().replaceAll('\\\\/', '/') + " playpath=" + secCode + " swfurl=" + secMatcher[0][1].trim() + " pageurl=http://www.ilive.to token=" + token + " live=1"
I am attaching my experimental version of the plugin (which probably doesn't work as is).
EDIT: Removed the attached file as it was not working. Attached proper plugin two posts down.
jhb50, do you keep your plugins in a public repository such as Github? it would make collaborating easier.
A slight detail to consider in further development is this: the plugin does not honor the maxItems parameter passed to the extractItems() method. That could be easily fixed.
Regards
/ O