PDA

View Full Version : Help needed wiuth a script



apsattv
10-12-2015, 01:05 AM
I'm trying to workout how to take this working live stream from ABC Australia and put it into a batch file so that each time it is run it will fetch the fresh token from

http://iview.abc.net.au/auth/flash?1449126899716

under "tokenhd" replace that in the URL after hdnea=

Valid format shown as below

livestreamer --http-header "X-Forwarded-For=101.175.18.124" "hds://http://abctvlivehds-lh.akamaihd.net/z/abc1_1@360322/manifest.f4m?hdnea=st=1448962086~exp=1448972085~ac l=/*~hmac=efb0611272d1c233612ec9c17e4c0b6f180d0ec476c 1de86de1a8ca54375572f pvswf=http://iview.abc.net.au/assets/swf/cineramaWrapper_Acc_018.swf?version=0.2" best

Greg
10-12-2015, 07:33 AM
Blimmin heck it's been donkey years since I played with batch files, so sorry I can't help. But I thought I'd comment cos I doubt the format shown can be valid, cos theres spaces in the code which, to the best of my knowledge makes it invalid.

Valid format shown as below

livestreamer*--http-header "X-Forwarded-For=101.175.18.124"*"hds://http://abctvlivehds-lh.akamaihd.net/z/abc1_1@360322/manifest.f4m?hdnea=st=1448962086~exp=1448972085~ac l=/*~hmac=efb0611272d1c233612ec9c17e4c0b6f180d0ec476c 1de86de1a8ca54375572f pvswf=http://iview.abc.net.au/assets/swf/cineramaWrapper_Acc_018.swf?version=0.2" best

apsattv
10-12-2015, 01:34 PM
It is valid and works. I have the OZ channel 7 working fine..
Install livestreamer you will see it works

Kame
10-12-2015, 01:54 PM
Are we working in Windows? in a batch file, possible? but you are better with a non native actual xml parser, as you rely on a certain structure or correctness, but hopefully this site keeps it clean.

I don't have time to explain, but you would possibly download the xml file, not sure if it can be parsed online, you would then work with "findstr" to locate the token you need.

Look up how you can use findstr to parse xml and you will find solutions.

Cheers,

KK

apsattv
10-12-2015, 05:28 PM
How about I just upload what I made already.

https://mega.nz/#!cE5VHYBD!OyMxulY_b-YcZoZNa1gn6rje5vkB6fAKgbh0VeQbHVc

you can look it over

Thunderflash
13-12-2015, 04:12 PM
How are you getting on with this script? I'm no help, but I'm looking forward to the completed version. Will you be able to include the Ch9 mux of stations in it? Thanks

apsattv
13-12-2015, 05:03 PM
Nothing as yet

Thunderflash
13-12-2015, 08:47 PM
Nothing as yet

Cheers

Kame
16-12-2015, 01:58 PM
Sorry apsattv,

I am really busy but have looked at your script, it would be nice if it was reliant on just one file which I will get around to but to speed up the process I will use two files, a batch file that will receive the token required using windows script hosting, my language of choice would be javascript but vbscript would work too. To be honest, everything could be done through windows script hosting, as batch is very limited.

I will just outline my method incase you can maybe whip something up before I get round to it. I have very little time around this season.

In your batch file, it'll have a call (cscript) that will run the javascript file and store the needed string you require in a variable that you can use however you like.

Inside the javascript file it will load the XML of that link and return the string you require. You will probably use Msxml2 DOMDocument, load the link, parse the string out using DOM methods to get the element and the child's value and return it back to your script.

Well, thats the basics of what you could do, or if I do find time, I'll post the script but my method will be combining batch and javascript in the same file.

Hopefully this gives you a better means to solving your problem, if using just windows scripting host (far more powerful) then you should consider just using that, it works similar to batch and can be seen as its successor.

Cheers,

KK

apsattv
16-12-2015, 08:37 PM
Whatever way that works, and is easy to add to is fine by me. I know very little about such things other than what I had worked out already.
It is only the abc stream that needs the extra procedure.

Thunderflash
13-02-2016, 05:54 PM
Hi Apsattv. Are you able to add the Chan9 streams to this script? Thanks