Added stuff so you can search safe or not, and excluded images from being uploaded to git
This commit is contained in:
parent
8129565180
commit
8acc2a04bf
2 changed files with 21 additions and 8 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -117,4 +117,7 @@ dist
|
|||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
.vscode/*
|
||||
.vscode/*
|
||||
|
||||
#merde
|
||||
img/*
|
|
@ -11,21 +11,31 @@ function search() {
|
|||
console.log(err);
|
||||
return;
|
||||
}
|
||||
//Get list of posts for the tag(s)
|
||||
request(
|
||||
`https://${config.booru}.donmai.us/posts.json?tags=${config.tags}&z=1`,
|
||||
{ json: true },
|
||||
(err, res, body) => {
|
||||
|
||||
if (config.rating === "safe") {
|
||||
let queryUrl = `https://${config.booru}.donmai.us/posts.json?tags=${config.tags}+rating:${config.rating}&z=1`;
|
||||
request(queryUrl, { json: true }, (err, res, body) => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
const randPost = Math.floor(Math.random() * body.length);
|
||||
const postID = body[randPost].id;
|
||||
getPost(postID);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
let queryUrl = `https://${config.booru}.donmai.us/posts.json?tags=${config.tags}&z=1`;
|
||||
request(queryUrl, { json: true }, (err, res, body) => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
const randPost = Math.floor(Math.random() * body.length);
|
||||
const postID = body[randPost].id;
|
||||
getPost(postID);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getPost(postID) {
|
||||
parseConfig.readConfig(configFile, (err, config) => {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in a new issue