Advertisement
ecco7777

CC MyFTBHastebinDownloader

May 16th, 2024 (edited)
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. -- Define the function to download from Hastebin
  2. local function downloadFromHastebin(pasteCode)
  3.     -- Define the Hastebin server address
  4.     local hastebinServer = "https://paste.myftb.de/raw/"
  5.     local url = hastebinServer .. pasteCode
  6.  
  7.     -- Fetch the data from the Hastebin server
  8.     local response = http.get(url)
  9.  
  10.     -- Check if the request was successful
  11.     if response then
  12.         local content = response.readAll()
  13.         response.close()
  14.  
  15.         -- Write the content to a file named with the paste code
  16.         local file = fs.open(pasteCode, "w")
  17.         file.write(content)
  18.         file.close()
  19.  
  20.         print("Downloaded and saved as " .. pasteCode)
  21.     else
  22.         print("Failed to download from Hastebin. Check the paste code and try again.")
  23.     end
  24. end
  25.  
  26. -- Get the paste code from the command line arguments
  27. local args = {...}
  28. if #args < 1 then
  29.     print("Usage: pasteDownload <pasteCode>")
  30.     return
  31. end
  32.  
  33. local pasteCode = args[1]
  34. downloadFromHastebin(pasteCode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement