Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isjsoninstalled()
- if fs.exists("json") then
- return true
- else
- print("JSON API Not found! Downloading...")
- resp = http.get("http://pastebin.com/raw.php?i=4nRg9CHU")
- if resp then
- handler = io.open("json","w")
- handler:write(resp.readAll())
- handler:close()
- end
- print("Finished downloading JSON API!")
- return true
- end
- end
- function live(streamid,colorLive,colorNotLive)
- isjsoninstalled()
- os.loadAPI("json")
- str = http.get("https://api.twitch.tv/kraken/streams/"..streamid).readAll()
- obj = json.decode(str)
- stream = obj.stream
- if stream ~= null then
- term.setTextColor(colorLive)
- print(streamid.." is live!")
- term.setTextColor(colors.white)
- else
- term.setTextColor(colorNotLive)
- print(streamid.." is not live!")
- term.setTextColor(colors.white)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement