Your friendly neighbourhood violinist bringing you the best booru images
- Currently supports searching up to 11 boorus with the ability to add custom ones
- Alias support
- Commonify; Adds a property to each image that will always have the same props no matter which booru you use
- Full promise support
npm install --save kaori
const Kaori = require('kaori');
const kaori = new Kaori();
kaori.search('danbooru', { tags: ['cat'], limit: 1, random: true })
.then(images => console.log(images[0].common.fileURL))
.catch(err => console.error(err));
But you can also append your own sites to the already preexisting ones, as shown in the examples folder, as follows:
const Kaori = require('kaori');
const moreSites = require('./moreSites');
const kaori = new Kaori(moreSites);
kaori.search('e621', { tags: ['furry'], limit: 1, random: true })
.then(images => console.log(images[0].common.fileURL))
.catch(err => console.error(err));
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
site | string | none | The booru you want to search; supports aliases | |
options | searchOptions | X | {} | Options for tags, amount of images, and if it should randomize |
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
tags | string[] | X | [] | The tags to search the boorus with |
limit | number | X | 1 | The max amount of images |
random | boolean | X | false | If the images should be randomized |
To make use of the functionality to add your own boorus you simple have to create a json file with following content:
{
"e621.net": {
"aliases": ["e621"],
"endpoint": "/post/index.json?",
"random": true
}
}
Require this json file and pass it the new instance of Kaori to apply the new sites to the already existing ones.
This will then allow you to call kaori.search('e621.net')
or any alias you specified.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Kaori © iCrawl, Released under the MIT License.
Authored and maintained by iCrawl.
GitHub @iCrawl · Twitter @iCrawlToGo