This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Zoinky's profile picture

How do I download pastebin code via http api?

Started by Zoinky, 31 August 2012 - 09:40 AM
Zoinky #1
Posted 31 August 2012 - 11:40 AM
I just made a post about how to remotely control turtles via rednet and found that the forum gave amazing help. So, I thought that I'd just get this question sorted while I had it in mind. I was wondering how to download pastebin code via http on the cc computers? I've tried to do it before with code other people suggested but I kept getting weird errors. I just wanted to know so I could use it if I ever needed it in the future. Thanks in advance :)/>/>

Edit: Oh and.. Save it. If that's possible.
DanCarl97 #2
Posted 31 August 2012 - 11:45 AM
You just use:

pastebin get <code> <NewFilepath>

Or in a program:

shell.run("pastebin","get","<code>","<NewFilepath>")
Zoinky #3
Posted 31 August 2012 - 11:56 AM
Could you give an example? I'm clueless (Hehe.)
BigSHinyToys #4
Posted 31 August 2012 - 11:59 AM
Example

pastebin get Bpqpcv9j AI
copy this from here then use Ctrl+V to enter it into the command interface NOT in a program. after that run AI

[EDIT]
You have to turn on HTTP api open the mods configure file and turn it on.
Zoinky #5
Posted 31 August 2012 - 12:05 PM
Example

pastebin get Bpqpcv9j AI
copy this from here then use Ctrl+V to enter it into the command interface NOT in a program. after that run AI

'No such program' I'm stupid.. Aren't I? I tried entering it into the Lua Interactive Interface too. No luck. I'm on ComputerCraft 1.3 if that changes anything.

Edit: Alright. Trying what you said in the edit. I'm guessing this doesn't work on servers then?
BigSHinyToys #6
Posted 31 August 2012 - 12:11 PM
goto C:\Documents and Settings\<your user>\Application Data\.minecraft\config
open "mod_ComputerCraft.cfg" with notepad

edit the line that says
enableAPI_http=0

so it is
enableAPI_http=1

then try my code again.

Not in lua or in a program in the console.
Zoinky #7
Posted 31 August 2012 - 12:12 PM
goto C:Documents and Settings<your user>Application Data.minecraftconfig
open "mod_ComputerCraft.cfg" with notepad

edit the line that says
enableAPI_http=0

so it is
enableAPI_http=1

then try my code again.

Not in lua or in a program in the console.

It worked! Thanks :)/>/> Does the api work on server's too?
BigSHinyToys #8
Posted 31 August 2012 - 12:14 PM
if the server operator has it turned on the yes you can get from pastebin if not you might want to ask them to enable it.
DanCarl97 #9
Posted 31 August 2012 - 12:57 PM
It might be a bit of a task to gtet them to enable it because they can be security issues, plus they don't want people downloading too much :)/>/>
D3matt #10
Posted 01 September 2012 - 01:08 AM
It might be a bit of a task to gtet them to enable it because they can be security issues, plus they don't want people downloading too much :)/>/>
Both of these reasons are utterly and completely false. You use more bandwidth simply playing on the server than even the largest CC programs take up. And there is no security issues with the http API unless you've got some huge underlying problem to begin with.
SomniusX #11
Posted 13 November 2012 - 03:59 AM
well I'd like to use the shell command to fetch the each time updated script to run on computer startup,
maybe a first test could be to
remove the local
fetch the new one
run a script to attach the new one on a nearby monitor

its a good way to update monitors that display rules or other large texts from your browser instead from inside mc, without even logging in to replace a startup file with another..

anybody made this before? cause from 1-2 search terms I used here didn't find even a tool like that or a feature of one of the os's
MegaShrimp #12
Posted 17 November 2012 - 12:12 PM
I'm in the latest update of CC and MC and I cant find this in the ComputerCraft.cfg file D: . All it has is "enableAPI_http" with a table after that
Lyqyd #13
Posted 17 November 2012 - 02:03 PM
My config line says this:

enableAPI_http=true
mattias1172 #14
Posted 28 December 2012 - 07:38 PM
is there a way to enable api_http using a command on the computer rather than finding it on ur actual computer?
HotGirlEAN #15
Posted 28 December 2012 - 07:52 PM
When HTTP API is enabled and you just wish to download without using the Pastebin program use the following code or similar code:

resp = http.get("http://pastebin.com/raw.php?i="..CODE)
if resp then
handler=io.open(FILE,"w")
handler:write(resp.readAll())
handler:close()
return true -- It worked
else
return fasle -- It failed
end
Arcturus125 #16
Posted 10 April 2013 - 11:37 AM
i use multimc and i have tried it all and it dosent work, if you can find a way to do it plz tell me.
also is there a way to manually download it (using multimc)
BigSHinyToys #17
Posted 10 April 2013 - 05:01 PM
i use multimc and i have tried it all and it dosent work, if you can find a way to do it plz tell me.
also is there a way to manually download it (using multimc)
You don't need to download the api just turn it on.

So you need to access the config file for miencraft. when you are using multy MC the file is stored in a different location right click on an instance and view folder then open the .minecraft then configure then edit the file

open "mod_ComputerCraft.cfg" with notepad

edit the line that says
enableAPI_http=0

so it is
enableAPI_http=1
Noiro #18
Posted 10 April 2013 - 05:34 PM
The main reason an admin would keep it disabled is if he thinks CC is so OP and the only way to keep it fair is to force people to write their own code. Huge results? Then give up your own time and thinking power to get them! Using a command to get them in a few seconds is a bit cheaty. ;)/>

I've disabled the default excavate and tunnel programs on my server.
Arcturus125 #19
Posted 11 April 2013 - 02:03 AM
i use multimc and i have tried it all and it dosent work, if you can find a way to do it plz tell me. also is there a way to manually download it (using multimc)
You don't need to download the api just turn it on. So you need to access the config file for miencraft. when you are using multy MC the file is stored in a different location right click on an instance and view folder then open the .minecraft then configure then edit the file open "mod_ComputerCraft.cfg" with notepad edit the line that says enableAPI_http=0 so it is enableAPI_http=1

i did i tried enableAPI http= true and 1 it still didn't work
"pastebin get 6qmBBLpz epicmine"
i types in that above but is replied with "no such program"
Arcturus125 #20
Posted 11 April 2013 - 03:57 AM
nevermind, i found a fix
willwac #21
Posted 14 September 2013 - 05:16 PM
When HTTP API is enabled and you just wish to download without using the Pastebin program use the following code or similar code:

resp = http.get("http://pastebin.com/raw.php?i="..CODE)
if resp then
handler=io.open(FILE,"w")
handler:write(resp.readAll())
handler:close()
return true -- It worked
else
return fasle -- It failed
end

Thanks, this really helped.
willwac #22
Posted 03 October 2013 - 08:08 PM
Oh! what did you do to fix it?
AgentE382 #23
Posted 03 October 2013 - 11:35 PM
The main reason an admin would keep it disabled is if he thinks CC is so OP and the only way to keep it fair is to force people to write their own code. Huge results? Then give up your own time and thinking power to get them! Using a command to get them in a few seconds is a bit cheaty. ;)/>

I've disabled the default excavate and tunnel programs on my server.

Mudkip's AutoTyper :D/> :P/>