Jump to content




How do I download pastebin code via http api?


22 replies to this topic

#1 Zoinky

  • Members
  • 144 posts
  • LocationWellington, New Zealand

Posted 31 August 2012 - 10: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.

#2 DanCarl97

  • New Members
  • 16 posts

Posted 31 August 2012 - 10:45 AM

You just use:

pastebin get <code> <NewFilepath>

Or in a program:

shell.run("pastebin","get","<code>","<NewFilepath>")


#3 Zoinky

  • Members
  • 144 posts
  • LocationWellington, New Zealand

Posted 31 August 2012 - 10:56 AM

Could you give an example? I'm clueless (Hehe.)

#4 BigSHinyToys

  • Members
  • 1,001 posts

Posted 31 August 2012 - 10: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.

#5 Zoinky

  • Members
  • 144 posts
  • LocationWellington, New Zealand

Posted 31 August 2012 - 11:05 AM

View PostBigSHinyToys, on 31 August 2012 - 10:59 AM, said:

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?

#6 BigSHinyToys

  • Members
  • 1,001 posts

Posted 31 August 2012 - 11:11 AM

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.

#7 Zoinky

  • Members
  • 144 posts
  • LocationWellington, New Zealand

Posted 31 August 2012 - 11:12 AM

View PostBigSHinyToys, on 31 August 2012 - 11:11 AM, said:

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?

#8 BigSHinyToys

  • Members
  • 1,001 posts

Posted 31 August 2012 - 11:14 AM

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.

#9 DanCarl97

  • New Members
  • 16 posts

Posted 31 August 2012 - 11:57 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 :)/>

#10 D3matt

  • Members
  • 830 posts

Posted 01 September 2012 - 12:08 AM

View PostDanCarl97, on 31 August 2012 - 11:57 AM, said:

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.

#11 SomniusX

  • New Members
  • 2 posts

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

#12 MegaShrimp

  • New Members
  • 13 posts

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

#13 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,462 posts

Posted 17 November 2012 - 02:03 PM

My config line says this:

enableAPI_http=true

#14 mattias1172

  • New Members
  • 9 posts

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?

#15 HotGirlEAN

  • Banned
  • 101 posts

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


#16 Arcturus125

  • Members
  • 3 posts

Posted 10 April 2013 - 10: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)

#17 BigSHinyToys

  • Members
  • 1,001 posts

Posted 10 April 2013 - 04:01 PM

View PostArcturus125, on 10 April 2013 - 10:37 AM, said:

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

#18 Noiro

  • Members
  • 65 posts

Posted 10 April 2013 - 04: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.

#19 Arcturus125

  • Members
  • 3 posts

Posted 11 April 2013 - 01:03 AM

View PostBigSHinyToys, on 10 April 2013 - 04:01 PM, said:

View PostArcturus125, on 10 April 2013 - 10:37 AM, said:

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"

#20 Arcturus125

  • Members
  • 3 posts

Posted 11 April 2013 - 02:57 AM

nevermind, i found a fix





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users