Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getLatestPaste()
- local h = http.post("https://pastebin.com/api/api_post.php","api_option=list&api_user_key=bb05551ae175b44ed1791e5efc6151ed&api_dev_key=eabc602e583049d95051a0e2f75cc77f&api_results_limit=1")
- if not (h==nil) then
- local r = ""
- while true do
- local l = h.readLine()
- if l==nil then break end
- if string.sub(l,0,11)=="<paste_key>" then r=l end
- end
- local pk = string.gsub(r,"<paste_key>(%w+)</paste_key>","%1")
- local gh = http.get("https://pastebin.com/raw/"..pk)
- local text = gh.readAll()
- local ret = {}
- ret["key"] = pk
- ret["text"] = text
- return ret
- else
- return nil
- end
- end
- function getNewPaste()
- lkey = ""
- if fs.exists("/last") then
- f = fs.open("/last","r")
- lkey = f.readAll()
- f.close()
- end
- np = getLatestPaste()
- if not (lkey==np["key"]) then
- f = fs.open("/last","w")
- f.writeLine(np["key"])
- f.close()
- return np
- else
- return nil
- end
- end
- local p = getNewPaset()
- write(p["key"].." >> "..p["text"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement