Advertisement
Null_Cat

Grab Pastes in Roblox

Nov 28th, 2018
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. --this first part is definitely not taken from https://developer.roblox.com/api-reference/function/HttpService/PostAsync
  2.  
  3. local HttpService = game:GetService("HttpService")
  4.  
  5. local URL_PASTEBIN = "https://pastebin.com/api/api_post.php"
  6. local dataFields = {
  7.     ["api_dev_key"] = "INSERT_VERY_NICE_DEV_KEY";
  8.     ["api_option"] = "list";
  9.     ["api_results_limit"] = "50";
  10.   ["api_user_key"] = "INSERT_VERY_NICE_USER_KEY";
  11. }
  12.  
  13. local data = ""
  14. for k, v in pairs(dataFields) do
  15.     data = data .. ("&%s=%s"):format(
  16.         HttpService:UrlEncode(k),
  17.         HttpService:UrlEncode(v)
  18.     )
  19. end
  20. data = data:sub(2)
  21.  
  22. local response = HttpService:PostAsync(URL_PASTEBIN, data, Enum.HttpContentType.ApplicationUrlEncoded, false)
  23.  
  24. local pastetitle = {}
  25. local pasteurl = {}
  26. local pasteformat = {}
  27. local pasteexpose = {}
  28. for capture in string.gmatch(response, "%<paste%_title%>(.-)%<%/paste%_title%>") do
  29.   table.insert(pastetitle, capture)
  30. end
  31. for capture in string.gmatch(response, "%<paste%_url%>(.-)%<%/paste%_url%>") do
  32.   table.insert(pasteurl, capture)
  33. end
  34. for capture in string.gmatch(response, "%<paste%_private%>(.-)%<%/paste%_private%>") do
  35.   if capture == "0" then
  36.     capture = "Public"
  37.   elseif capture == "1" then
  38.     capture = "Unlisted"
  39.   elseif capture == "2" then
  40.     capture = "Private (WARN)"
  41.   end
  42.   table.insert(pasteexpose, capture)
  43. end
  44. for capture in string.gmatch(response, "%<paste%_format%_long>(.-)%<%/paste%_format%_long%>") do
  45.   if capture == "Lua" then
  46.     capture = "Lua"
  47.   elseif capture == "None" then
  48.     capture = "Unspecified"
  49.   else
  50.     capture = capture .. " (WARN)"
  51.   end
  52.   table.insert(pasteformat, capture)
  53. end
  54. for i=1,#pastetitle do
  55.   print("----------------")
  56.   print(pastetitle[i])
  57.   print(pasteurl[i])
  58.   if string.find(pasteformat[i], "(WARN)") ~= nil then
  59.     warn(pasteformat[i])
  60.   else
  61.     print(pasteformat[i])
  62.   end
  63.   if pasteexpose[i] == "Private (WARN)" then
  64.     warn(pasteexpose[i])
  65.   else
  66.     print(pasteexpose[i])
  67.   end
  68. end
  69. print("----------------")
  70. script:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement