Last active
August 29, 2015 13:56
-
-
Save vladkorotnev/9276548 to your computer and use it in GitHub Desktop.
Grab camera stream list from Ufanet Maps
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
// Grab Ufanet Camera Streams | |
// By Akasaka Ryuunosuke | |
// 2014/03/01 | |
var cameras = ''; var k = ''; | |
for(var key in layouts) { if(key.substr(0,4) == 'cctv') k=key; } | |
for(var i in layouts[k]._layers) { | |
var cam = layouts[k]._layers[i]; | |
var url = "http://"+cam.server+"/"+cam.number+"/index.m3u8?token=maps&autoPlay=true"; | |
cameras += cam.name + ": "+url+"\n"; | |
} | |
document.write('<textarea style="font-family:monospace; width:800px; height: 800px; min-width:800px; min-height:800px;">'+"This awesomeness done by NSAkasaka, 2014. :P \nUse VLC to watch.\n=====\n"+cameras+'</textarea>'); |
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
// Grab Ufanet Camera Streams | |
// m3u maker version | |
// By Akasaka Ryuunosuke | |
// 2014/03/01 | |
function replaceAll(find, replace, str) { | |
return str.replace(new RegExp(find, 'g'), replace); | |
} | |
var cameras = '#EXTM3U'+"\n"; var k = ''; | |
for(var key in layouts) { if(key.substr(0,4) == 'cctv') k=key; } | |
for(var i in layouts[k]._layers) { | |
var cam = layouts[k]._layers[i]; | |
var url = "http://"+cam.server+"/"+cam.number+"/index.m3u8?token=maps&autoPlay=true"; | |
cameras += "#EXTINF:-1, "+replaceAll("-","",replaceAll("—","",replaceAll(",","",cam.name))) + "\n"+url+"\n"; | |
} | |
document.write('<textarea style="font-family:monospace; width:800px; height: 800px; min-width:800px; min-height:800px;">'+"This awesomeness done by NSAkasaka, 2014. :P \nUse VLC to watch.\n=====\n"+cameras+'</textarea>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment