Advertisement
Guest User

Twitter

a guest
Jul 30th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local mon = peripheral.wrap("back")
  2. term.redirect(mon)
  3. os.loadAPI("json")
  4. term.clear()
  5. term.setTextColor(colors.gray)
  6. print("Twitter GET v2.1")
  7. term.setCursorPos(3,1)
  8. Incr = 0
  9.  
  10.  
  11. while true do
  12.  
  13.   local contenu = http.get("http://goofyplace.org/Black/twitter/request.php?user=FeedTheTrouduc")
  14.   local contenu = http.get("http://goofyplace.org/Black/twitter/request.php?user=FeedThePatrick")
  15.   local data = contenu.readAll()
  16.  
  17.   decode = json.decode(data)
  18.   i = 10
  19.  
  20.     while i <= 10 do
  21.       if decode.statuses[i] ~= null then
  22.          local text = decode.statuses[i].text
  23.          text = text:gsub("u00e9","e")
  24.          text = text:gsub("u00e0","a")
  25.          text = text:gsub("u00a0"," ")
  26.         local from = decode.statuses[i].user.name
  27.         local long = string.len(from)
  28.         local I = 74 - long
  29.        
  30.       if Incr==0 then
  31.         color = colors.white
  32.       elseif Incr == 1 then
  33.         color = colors.orange
  34.       elseif Incr == 2 then
  35.         color = colors.magenta
  36.       elseif Incr == 3 then
  37.         color = colors.yellow
  38.       elseif Incr == 4 then
  39.         color = colors.lime
  40.       elseif Incr == 5 then
  41.         color = colors.pink
  42.       elseif Incr == 6 then
  43.         color = colors.gray
  44.       elseif Incr == 7 then
  45.         color = colors.cyan
  46.       elseif Incr == 8 then
  47.         color = colors.purple
  48.       elseif Incr == 9 then
  49.         color = colors.blue
  50.       elseif Incr == 10 then
  51.         color  = colors.brown
  52.       elseif Incr == 11 then
  53.         color = colors.green
  54.       else
  55.         Incr = 0
  56.       end
  57.  
  58.  
  59.     Incr = Incr + 1
  60.     term.setTextColor(color)
  61.         print("----------------------------------------------------------------------------------")
  62.         print("\n "..text)
  63.         write("\n from : " ..from)
  64.     print("\n----------------------------------------------------------------------------------")
  65.         while I > 0 do
  66.             I = I - 1
  67.         end
  68.       end
  69.  
  70.     i = i - 1
  71.     sleep(0.1)
  72.     end
  73.  
  74.     sleep(60)
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement