This package has been deprecated

Author message:

Furry Bot API has been transformed into YiffyAPI, please migrate there.

foxapi
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Fox API

This module is a little compilation of a fex fox image apis I know of, namely randomfox.ca, foxrudor.de, and api.furry.bot.

Every function returns the same structure, so the implementations can be the same. Each of them also has one optional parameter, fetchImage, this will return the json body, as well as a buffer that contains the image, there is an example for that down here

The way to reach each of them is as follows:

randomfox.ca: ca

const FoxAPI = require("foxapi");
const f = new FoxAPI("FoxAPI/1.0.1 (https://github.com/FurryBotCo/FoxAPI"));
 
f.ca().then(res => console.log(res));
// in the console:
/*
{
    success: true,
    response: {
        image: "https://randomfox.ca/images/83.jpg",
        filetype: "jpg",
        name: "83.jpg"
    }
}
*/

foxrudor.de: de

const FoxAPI = require("foxapi");
const f = new FoxAPI("FoxAPI/1.0.1 (https://github.com/FurryBotCo/FoxAPI"));
 
// this api does not return any json, or any links to images, it just directly returns an image, so we improvise
 
f.de().then(res => console.log(res));
// in the console:
/*
{
    success: true,
    response: {
        image: "https://foxrudor.de",
        filetype: "jpg",
        name: "foxrudor.de.jpg"
    }
}
*/

api.furry.bot: fb

const FoxAPI = require("foxapi");
const f = new FoxAPI("FoxAPI/1.0.1 (https://github.com/FurryBotCo/FoxAPI"));
 
f.fb().then(res => console.log(res));
// in the console:
/*
{
    success: true,
    response: {
        image: "https://i.furcdn.net/animals/fox/a6f5338446968dbe0586735cc4002ab4.jpg",
        filetype: "jpg",
        name: "a6f5338446968dbe0586735cc4002ab4.jpg"
    }
}
*/
fetchImage example
const FoxAPI = require("foxapi");
const f = new FoxAPI("FoxAPI/1.0.1 (https://github.com/FurryBotCo/FoxAPI"));
 
f.fb(true).then(res => console.log(res));
// in the console:
/*
{
    image: (ImageBuffer),
    success: true,
    response: {
        image: "https://i.furcdn.net/animals/fox/a6f5338446968dbe0586735cc4002ab4.jpg",
        filetype: "jpg",
        name: "a6f5338446968dbe0586735cc4002ab4.jpg"
    }
}
*/

Readme

Keywords

Package Sidebar

Install

npm i foxapi

Weekly Downloads

1

Version

1.0.1

License

AGPL-3.0

Unpacked Size

18.4 kB

Total Files

9

Last publish

Collaborators

  • donovan_dmc