animegirlapi
v1.5.0
Published
An API that can output anime girls, and is 100% manually verified
Downloads
3
Readme
Random Image Fetcher
This JavaScript module provides functions to fetch random images from an API based on specified tags and ratings. It supports filtering images by tags and ratings, downloading images, and retrieving metadata about tags and ratings.
Functions
getRandomImage({ number, tag, rating, ignore, random })
Fetches a random image from the API that matches the specified tag(s) and/or rating(s).
Parameters:
number
(number): The number of images to request. Default is 1. Must be 100 or fewer.tag
(string | string[] | null, optional): A tag or a list of tags to filter images. If null, no tag filtering is applied.rating
(string | string[] | null, optional): A rating or a list of ratings to filter images. If null, no rating filtering is applied.ignore
(boolean, optional): If false and not enough images are found, a warning is printed. If true, no warning is printed. Default is false.random
(boolean, optional): If true, shuffles the images randomly before filtering.
Returns: Promise<string[]>: A promise that resolves to a list of URLs for the requested number of images. Returns an empty array if no images are found.
Example Usage:
const { getRandomImage } = require('animegirlapi');
// Fetch 5 random images with tag "yuri" and rating "safe"
getRandomImage({ number: 5, tag: 'yuri', rating: 'safe' })
.then(images => console.log(images));
// Fetch 10 random images with tag "catgirl" without checking for rating
getRandomImage({ number: 10, tag: 'catgirl' })
.then(images => console.log(images));
// Fetch 3 random images with rating "explicit" and ignore the warning if not enough images are found
getRandomImage({ number: 3, rating: 'nsfw', ignore: true })
.then(images => console.log(images));
// Fetch 4 random images with multiple tags
getRandomImage({ number: 4, tag: ['yuri', 'catgirl'] })
.then(images => console.log(images));
getInfo(url)
Fetches metadata about a specific image URL, including tags and rating.
Parameters:
- url (string): The URL of the image to fetch metadata for.
Returns: Promise: A promise that resolves to an object containing the tags and rating of the image.
Example Usage:
const { getInfo } = require('animegirlapi');
getInfo('https://www.catgirlnexus.xyz/api/storage/image_145.png')
.then(info => console.log(info));
downloadImage(url, output)
Downloads an image from the specified URL and saves it to the given output path.
Parameters:
url
(string): The URL of the image to download.output
(string | null, optional): The file path to save the image. If null, saves the image in the current directory with the filename extracted from the URL.
Returns: Promise: A promise that resolves to an object containing the path where the image was saved.
Example Usage:
const { downloadImage } = require('animegirlapi');
downloadImage('https://www.catgirlnexus.xyz/api/storage/image_145.png', 'images/image_145.png')
.then(response => console.log('Image saved at:', response.path));
getAllImages()
Fetches all available image URLs from the API.
Returns: Promise: A promise that resolves to an object containing all image URLs and their metadata.
Example Usage:
const { getAllImages } = require('animegirlapi');
getAllImages()
.then(images => console.log(images));
getAllTags()
Fetches a list of all available tags with their descriptions.
Returns: Promise: A promise that resolves to an object containing all tags and their descriptions.
Example Usage:
const { getAllTags } = require('animegirlapi');
getAllTags()
.then(tags => console.log(tags));`
getAllRatings()
Fetches a list of all available ratings.
Returns: Promise<string[]>: A promise that resolves to an array of ratings.
Example Usage:
const { getAllRatings } = require('animegirlapi');
getAllRatings()
.then(ratings => console.log(ratings));
Tags
- "vampire": "A character with vampiric traits."
- "gothic": "A character with a dark, gothic style."
- "demon": "A character with demonic traits."
- "kawaii": "A character with an extremely cute and endearing appearance."
- "magical girl": "A character with magical abilities, often with a transformation theme"
- "romantic": "A character in a romantic or affectionate pose."
- "bunnygirl": "A character with bunny ears and traits."
- "catgirl": "A character with cat ears and traits."
- "foxgirl": "A character with fox ears and traits."
- "big breast": "A character with a large bust."
- "heterochromia": "A character with two different-colored eyes, often adding a unique and striking visual trait."
- "small breast": "A character with a small bust."
- "yuri": "Content focusing on romantic relationships between women."
- "multiple girl": "Content involving multiple female characters."
- "schoolgirl": "A character dressed as a schoolgirl."
- "elf": "A character with elf-like features."
- "other animal": "There are other animals in the picture."
- "feet": "Contains feet images."
- "puppygirl": "A character with dog ears and traits."
- "favorites": "Favorites of the owner."
- "blush": "Contains image of heavy blushing."
- "maid": "A character dressed in a maid uniform with charming and elegant traits."
- "loli": "A character depicted as young, petite, and often very cute, embodying a childlike or youthful appearance."
Ratings
- "safe": This is 100% safe.
- "suggestive": Isn't borderline but is suggestive.
- "very suggestive": Borderline of suggestive.
- "nsfw": This is 18+.
Error Handling
- Throws a
RangeError
if the number exceeds 100. - Prints a warning message if the number of images requested cannot be fulfilled and
ignore
is false.
Dependencies
axios
(for making HTTP requests to the API).lodash
(for utility functions).
Contact
For additional support or to request more images with specific tags, you may contact _.lex0 on Discord.
License
This project is licensed under the MIT License. See the terms of service & privacy policy located on the home page.