Advertisement
Xylem_Gaming

YouTube API ComputerCraft Compat

Jan 23rd, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. html = http.get("https://www.googleapis.com/youtube/v3/channels?part=statistics&id=YOUR CHANNEL ID&key=YOUR API KEY")
  2. --Replace 'YOUR CHANNEL ID' with the real thing as well as 'YOUR API KEY'
  3. body = html.readAll()
  4.  
  5. mins = string.find(body, "subscriber")
  6. maxs = string.find(body, "hidden")
  7. subscribers = string.sub(body,mins+19,maxs-9)
  8. print("Subscribers: "..subscribers)
  9. --Subscrubers
  10. mins2 = string.find(body, "view")
  11. maxs2 = string.find(body, "comment")
  12. view = string.sub(body,mins2+13,maxs2-9)
  13. print("View: "..view)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement