Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --=========--
- --Changelog--
- --=========--
- --Version 1.1.0
- --1. Fixed live() crash bug!
- --2. Made file smaller, to save on disk space using init()!
- --=========--
- --Changelog--
- --=========--
- function getStreamId(streamer)
- isjsoninstalled()
- str = http.get("https://beam.pro/api/v1/channels/"..streamer).readAll()
- obj = json.decode(str)
- return obj["id"]
- end
- function getChannel(streamname)
- streamid = getStreamId(streamname)
- str = http.get("https://beam.pro/api/v1/channels/"..streamid).readAll()
- obj = json.decode(str)
- return obj
- end
- function getFollow(streamname)
- streamid = setStreamId(streamname)
- str = http.get("https://beam.pro/api/v1/channels/"..streamid.."/follow").readAll()
- obj = json.decode(str)
- return obj
- end
- 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 checkLive(streamid)
- stream = getChannel(streamid)
- if stream["online"] == true then
- return true
- else
- return false
- end
- end
- function lastFollower(streamid)
- follow = getFollow(streamid)
- return lastfollow["username"]
- end
- function followerCount(streamid)
- stream = getChannel(streamid)
- follows = stream["numFollowers"]
- return follows
- end
- function viewerCount(streamid)
- stream = getChannel(streamid)
- return stream["viewersCurrent"]
- end
- function viewCount(streamid)
- stream = getChannel(streamid)
- return stream["viewersTotal"]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement