You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
Pulls random images from lolibooru.
|
|
|
|
Usage:
|
|
require("hashloli").randomise(function(datas) {
|
|
if(!datas)
|
|
{
|
|
//Error
|
|
console.log(this.error);
|
|
return;
|
|
}
|
|
datas.forEach(function(data) {
|
|
if(data) {
|
|
let file_url = data.file_url;
|
|
//Do stuff
|
|
|
|
} else {
|
|
//Error
|
|
}
|
|
}
|
|
});
|
|
|
|
randomise() can take a second argument to specify configuration. The default is
|
|
new require("hashloli").Config();
|
|
See randomise.js for an example.
|
|
|
|
Command line usage:
|
|
node randomise.js [--verbose] [--debug] [--range=<range>] [--number=<number>] [--page=<page>] [<tags ...>]
|
|
Echos either the file url or `undefined' if there was an error. Echos full data in JSON if --verbose is supplied, also prints debug and error messages if --debug is supplied.
|
|
The default range is 5.
|
|
The default number is 1.
|
|
The default (max) page is 150.
|
|
If the number exceeds the range then the range is set equal to the number.
|
|
|
|
More advanced example:
|
|
node randomise.js --verbose --page=10 --number=5 flandre_scarlet blush
|
|
|
|
Npm dependancies:
|
|
xmlhttprequest
|