Ahoy nerds! Some cool pirate related API’S

Happy international speak-like-a-pirate day! As part of my legal-document-writing-procrastinating I began researching pirate translators – thanks to Cyborgs’ genius idea of writing a section 6 in pirate language;*

I stumbled upon the treasure chest that is pirate.monkeyness.com.

pirate.monkeyness.com hosts not one but two glorious API’s, the first of which is a pirate translator and the second of which is a pirate insult generator.

There are so many wonderfully stupid ways to use this API – let your creativity run free! My first project will be an arduino-powered doorbell that shouts pirate insults at any bailiffs, security, police or stressed out landlords that press it. Here’s a compass for it-

Full post coming soon!

Using the API is simple – simply send an HTTP GET request in your favourite language to either https://pirate.monkeyness.com/api/insult, which will return a random insult or to https://pirate.monkeyness.com/api/translate, with the parameter “english” set to the text you would like to translate, URL-encoded – which will return your text, pirate-translated. Here are some examples of how to use it in code:

Command line (linux/macos/windows):

curl --data-urlencode "english=[input]" "https://pirate.monkeyness.com/api/translate"

Python (also works on raspberry pi!):

import urllib3
http = urllib3.PoolManager()
input = "[input]" #text to translate
response = http.request('GET', 'https://pirate.monkeyness.com/api/translate', headers={
	'english': input
})
output = response.data.decode('utf-8')
print(output)

JavaScript:

fetch("https://pirate.monkeyness.com/api/insult").then(function(response) {
  return response.json();
}).then(function(data) {
  console.log(data);
}).catch(function() {
  console.log("Shiver me timbers!! An error!!");
});

Be sure to comment/post any ideas/experiments!


*which, if you’re interested in, is available here: