Jump to content




Pastebin Download Program Fix


5 replies to this topic

#1 Lego Stax

  • Members
  • 136 posts
  • LocationThe dark depths of the web

Posted 19 September 2014 - 02:25 AM

For those having the Duplicate entry '2147483647' for key 'PRIMARY' error in a file that you downloaded using the shell pastebin program, this program fixes that. Of course, it only has a download feature, as that is all that is required. I simply thought that I would provide a quick fix for those who are scouring the forums for it.

You can download it here, or you can copy the following code into the edit program:

local tArgs = { ... }
if #tArgs < 2 then
print(fs.getName(shell.getRunningProgram()).." <code> <path>")
return
end
if not fs.exists(tArgs[2]) then
-- Download
local response = http.get("http://pastebin.com/download.php?i="..tArgs[1])
if response then
  print("Success.")
  local data = response.readAll()
  local f = fs.open(tArgs[2], "w")
  f.write(data)
  f.close()
  print(tArgs[1].." has been saved to "..tArgs[2])
else
  print("Failure to download.")
end
else
print("File exists.")
end


The problem is simply that the shell pastebin program uses the URL: "http://pastebin.com/raw.php" whereas this program uses "http://pastebin.com/download.php"

Enjoy! :)

Edited by Lego Stax, 19 September 2014 - 02:25 AM.


#2 colcrunch

  • Members
  • 14 posts

Posted 19 September 2014 - 03:46 AM

I just did this and it is just getting all of the HTML, not the post.

#3 Lego Stax

  • Members
  • 136 posts
  • LocationThe dark depths of the web

Posted 19 September 2014 - 01:49 PM

View Postcolcrunch, on 19 September 2014 - 03:46 AM, said:

I just did this and it is just getting all of the HTML, not the post.
That's weird, it works for me.
Screeny:
Spoiler
Perhaps I should have kept this program to myself if it doesn't work for other people. Do you get the Duplicate entry '2147483647' for key 'PRIMARY' error in your pastebin downloads too?

Edited by Lego Stax, 20 September 2014 - 10:33 PM.


#4 Lignum

  • Members
  • 558 posts

Posted 19 September 2014 - 02:52 PM

View Postcolcrunch, on 19 September 2014 - 03:46 AM, said:

I just did this and it is just getting all of the HTML, not the post.
Pastebin will redirect you to its homepage if the id you've entered is invalid. This means that if you enter an invalid id, you'll get pastebin's source code instead of the paste. I haven't tried it but that's probably what's happening.

In short, make sure that the paste id you've entered is valid. If it is, it's a problem with the program.

Edited by Lignum, 19 September 2014 - 02:52 PM.


#5 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 19 September 2014 - 02:54 PM

Raw.php is working again anyway.

#6 Lego Stax

  • Members
  • 136 posts
  • LocationThe dark depths of the web

Posted 19 September 2014 - 08:58 PM

View PostLyqyd, on 19 September 2014 - 02:54 PM, said:

Raw.php is working again anyway.

Ah, okay. Well, if you want to lock this topic, then go right ahead. You have my consent.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users