Advertisement
willwac

Tiny.cc

Sep 30th, 2014
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. local url=...
  2. local key="e5000df5-6072-44d2-ad79-df80228e2123"
  3. if url=="help" or not url then
  4.     print("tiny.cc <url>")
  5.     print("Please do not abouse this program.")
  6. else
  7.     local raw=http.get("http://tiny.cc/?c=rest_api&m=shorten&version=2.0.3&longUrl="..url.."&login=willwac&apiKey="..key)
  8.     local data=raw.readLine()
  9.     function explode()
  10.     local pos,arr = 0,{}
  11.     for st,sp in function() return string.find(data:sub(2),"," and ":",pos,true) end do
  12.         table.insert(arr,string.sub(data:sub(2),pos,st-1))
  13.         pos = sp + 1
  14.     end
  15.     table.insert(arr,string.sub(data:sub(2),pos))
  16.     return arr
  17. end
  18. local t=explode()
  19. local u=t[5]:sub(2)..":"..t[6]:gsub("\\",""):sub(1,16)
  20. print("\nURL: "..u.."\nCode: "..u:sub(16))
  21. print("Please do not abouse this program.")
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement