Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local internet = require("internet")
- pastebin = {}
- pastebin.doc = {}
- pastebin.dev_key = ""
- pastebin.user_key = ""
- pastebin.post_url = "https://pastebin.com/api/api_post.php" -- Изменено на HTTPS
- pastebin.login_url = "https://pastebin.com/api/api_login.php" -- Изменено на HTTPS
- pastebin.raw_url = ""
- function pastebin.init(dev_key,user_key)
- pastebin.dev_key = dev_key
- pastebin.user_key = user_key or ""
- end
- function pastebin.create(name,text,private,time,syntax)
- private = private or 2
- time = time or "10M"
- syntax = syntax or "text"
- for k,_ in internet.request(pastebin.post_url,'api_option=paste&api_user_key='..pastebin.user_key..'&api_paste_private='..private..'&api_paste_name='..name..'&api_paste_expire_date='..time..'&api_paste_format='..syntax..'&api_dev_key='..pastebin.dev_key..'&api_paste_code='..text..'') do
- return k
- end
- end
- function pastebin.login(login,password)
- for k,_ in internet.request(pastebin.login_url,'api_dev_key='..pastebin.dev_key..'&api_user_name='..login..'&api_user_password='..password..'') do
- return k
- end
- end
- function pastebin.getList(results_limit)
- results_limit = results_limit or "100"
- return internet.request(pastebin.post_url,'api_option=list&api_user_key='..pastebin.user_key..'&api_dev_key='..pastebin.dev_key..'&api_results_limit='..results_limit..'')
- end
- function pastebin.getPasteInfo()
- return internet.request(pastebin.post_url,'api_option=trends&api_dev_key='..pastebin.dev_key..'')
- end
- function pastebin.delete(paste_key)
- for k,_ in internet.request(pastebin.post_url,'api_option=delete&api_user_key='..pastebin.user_key..'&api_dev_key='..pastebin.dev_key..'&api_paste_key='..paste_key..'') do
- return k
- end
- end
- function pastebin.getUserInfo(user_key)
- user_key = user_key or pastebin.user_key
- return internet.request(pastebin.post_url,'api_option=userdetails&api_user_key='..pastebin.user_key..'&api_dev_key='..pastebin.dev_key..'')
- end
- function pastebin.getRaw(paste_key,private)
- private = private or nil
- if private ~= nil then
- return internet.request(pastebin.raw_url,'api_option=show_paste&api_user_key='..pastebin.user_key..'&api_dev_key='..pastebin.dev_key..'&api_paste_key='..paste_key)
- else
- return internet.request('http://pastebin.com/raw/'..paste_key)
- end
- end
- return pastebin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement