censored
Sat, Apr 08 '17, 19:35
some tools to help with uploading/tagging
The normal process of uploading and tagging images is pretty tedious, so I'm sharing some of the scripts I've found to speed it up some.

1. You will need to get a userscript addon for your browser. I'm using one called TamperMonkey. (be careful what sorts of scripts you allow with this addon, only use scripts that are well documented from trustworthy sources)

2. From these two github pages, click the green Clone or Download button and download the repository as a zip.

Mass uploader
https://github.com/Seedmanc/Booru-mass-uploader

Augmentation (auto-complete search, on-page tag editor)
https://github.com/Seedmanc/Booru-Augmentation-Project

3. In your userscript addon, add the zip file from github. For TamperMonkey, open the dashboard, go to the Utilities tab, in the File Import section upload the the zip from github.

4. congratulations it should work and the scripts will run automatically while you are on sites marked in their headers. you can modify this if you don't want it on every booru site.


Script "Copy tags from Danbooru" (read other posts in this thread for more details)
https://pastebin.com/HT1VHe0T
This is a userscript you can install that will take an image on here, send it to iqdb, and try to copy over the tags of the closest match on danbooru. It works for just about every image that exists on danbooru, though it will copy bad tags if it doesn't find the correct image, so make sure you don't save those.
censored
Sat, Apr 08 '17, 19:39
also here's the mass tag editor I found, but I've yet to use it myself. pretty sure its also a userscript like the others.

https://github.com/ProximaNova/Booru-mass-editor
exo
Tue, Sep 05 '17, 21:16
I made a userscript to make tagging easier, it searches for the image on danbooru via iqdb and then gets the tags from danbooru: https://pastebin.com/ULMACqJQ

You use it with tampermonkey or greasemonkey (I haven't tested it on firefox, but it should work) like the scripts above. It will add a "search tags" button under the image next to the other options for the image if the image has a "tagme" tag. Tampermonkey will ask for permission twice (once for contacting iqdb and once for contacting danbooru), I suggest you click "always allow".

When you click the button it will add the danbooru tags to the tag editing box and open the original image in a new tab. The reason it opens the original image is to make it easier to spot when iqdb returns the wrong image with the wrong tags, although this isn't very common in my experience (it might be more common with other censorship styles). If you don't want the original image to be opened, you can set the "openOriginal" variable on line 16 to false.

On line 11-15, you can specify tags you want replaced, added or removed from the tags the script found on danbooru. By default it will replace "ass" with "censored ass", "breasts" with "censored_breasts", "pussy" with "censored_pussy" and remove a bunch of explicit tags. You might want to review these default settings.

You should also always manually check the added tags to make sure they're still applicable and not hidden under some censor bar (e.g. "blue_eyes" when eyes are censored). And don't forget to add the necessary censorship tags.

It's worth noting that the script will fail for high resolution images due to iqdb's maximum image file size. Even if it takes 10-20 seconds, it doesn't necessarily mean the script has failed: iqdb will sometimes make you wait for a while, although generally the script gets the tags within 2 seconds.
censored
Wed, Sep 06 '17, 01:41
oh wow this looks like it will save me tons of typing. thanks for sharing this.

for the tags you ignore, I'd say that tags that describe states of undress (nude, topless, bottomless, no_bra, no_panties, etc) should be kept. It's still useful for searching on here.

Also I'm not sure where to add this, but I'd like to have the script remove tags like artist_request, character_request, and tagme when it returns a valid tag list.
exo
Wed, Sep 06 '17, 03:04
I was removing those tags because it's usually not possible to see whether a character is wearing panties/bra/... under the censor (in my censors at least) and sometimes captions allude to that.

Removing tags that are already present is currently not possible, I'd have to write some extra code to do that.
censored
Fri, Nov 17 '17, 02:07
looks like danbooru's update yesterday broke this script. it can find the image with iqdb, but it doesn't get the tags from danbooru anymore. maybe this weekend if I get time I'll look closer at what danbooru changed and try to fix it.
censored
Sat, Nov 18 '17, 03:17
It looks like the exact html string the script was looking for got changed, so it wasn't finding anything. I changed it to look for something that's less likely to get changed, and it's working again.

https://pastebin.com/DkrSYhrV

I also neglected to try and support the new Meta tag category, since most of them won't apply to the booru here. The only one that comes to mind is game_cg. Just check the meta tags as you verify that the correct image was found.
censored
Sat, Mar 24 '18, 17:44
https://pastebin.com/HT1VHe0T

I've made a few changes to the tagging script

Changelog
1. Button for script now appears for every image. Previously the image needed a tagme tag, and to not be the most recently uploaded.
2. Changed button name to "Danbooru tags" and placed it beside Tag History
3. Changed the default tags ignored from Danbooru, using fewer so you can search here based on the original.
4. Added support for the new Meta tag category on Danbooru
5. Removes tagme, artist_request, and character_request tags if the real tag was found

Features I might work on next
- a second script to run for gelbooru when danbooru doesn't have the image
YamiLoli
Thu, Feb 17 '22, 04:25
Scripts not working
Hey,

I know this thread is quite old, but are the scripts supposed to still work?

Both scripts (augmentation and danbooru tags) show their interface (ability to add/remove tags easily, change settings for augmentation and the "Danbooru tags" button) but they don't actually do anything. The augmentation doesn't actually apply the changed tags, and danbooru tags button doesn't work at all.

I am using Opera GX, but Chrome doesn't work either.

I wonder if there's anything I can do to fix that?
censored
Thu, Feb 17 '22, 11:14
its been a while since i've tried using these.

i know the mass uploader one still works, at least for the main thing i used it for, making the tag editing box appear without needing to click the edit button.

i had to stop using the augmentation one because it did not handle the capchas well

the danbooru tags script was written by a user here and then i had been modifying it to make it work as danbooru changed their website. id have to go debugging it again to see what's happening there.
censored
Thu, Feb 17 '22, 11:23
oh I see what happened. it was about a year ago where I had to rewrite part of the danbooru tag script. I posted the new version to the discord server, but never updated it in this thread. try using this script. if you want real indentations, you can find a .js file on the discord pinned in the #tools=and=software channel.

// ==UserScript==
// @name Copy Tags from Danbooru
// @version 1.2
// @description gets tags from danbooru
// @authors exo (original), tbw (updates)
// @match https://censored.booru.org/index.php?page=post*
// @connect https://danbooru.iqdb.org/*
// @connect https://danbooru.donmai.us/*
// @grant GM_xmlhttpRequest
// @grant GM_openInTab
// @run-at document-end
// ==/UserScript==

var tagsToReplace = ["breasts censored_breasts", "ass censored_ass", "pussy censored_pussy"]; //add tags you want to replace here.
var tagsToAdd = []; //add tags you want to add here.
var tagsToRemove = ["bad_id", "bad_pixiv_id", "censored", "mosaic_censoring", "uncensored", "commentary", "commentary_request", "translated", "translation_request", "annotation_request", "source_request"]; //add tags you want to remove here.
var openOriginal = true; // change this to "var openOriginal = false" if you don't want to open the original image in a new tab. Warning: this will make it harder to notice that iqdb has returned a wrong image with wrong tags.


var iqdbTemplate = "https://danbooru.iqdb.org/?url=";
var clicked = false;
var danbooruURL;

function initialize(){
var imageURL = getImageUrl();
console.log('url is: '+imageURL);
getDanbooruUrl(imageURL);
}

function getImageUrl(){
return document.getElementById("image").src;
}

function getDanbooruUrl(imageUrl){
var iqdbUrl = iqdbTemplate+imageUrl;
var req = GM_xmlhttpRequest({
method: "GET",
url: iqdbUrl,
onload: function(){
console.log("parsing iqdb response");
var parser = new DOMParser();
var response = parser.parseFromString(this.responseText, "text/html");
resultNode = response.getElementById("pages").childNodes[2];
if(resultNode.innerHTML.includes("No relevant matches")){
resultNode = response.getElementById("pages").childNodes[5];
}
danbooruURL = resultNode.getElementsByTagName("a")[0].href;
getDanbooruTags(danbooruURL);
}
});
}

function getDanbooruTags(danbooruURL){
var req = GM_xmlhttpRequest({
method: "GET",
url: danbooruURL,
onload: function(){
console.log("danbooru url: "+danbooruURL);
console.log("parsing danbooru tags");
var parser = new DOMParser();
var response = parser.parseFromString(this.responseText, "text/html");
var tagList = response.getElementById("tag-list");
var copyrightTagList = tagList.querySelector("ul.copyright-tag-list");
var characterTagList = tagList.querySelector("ul.character-tag-list");
var artistTagList = tagList.querySelector("ul.artist-tag-list");
var generalTagList = tagList.querySelector("ul.general-tag-list");
var metaTagList = tagList.querySelector("ul.meta-tag-list");
var copyrightTags = [];
var artistTags = [];
var characterTags = [];
var imageTags = [];
var metaTags = [];
var children = tagList.childNodes;
var tagsNotArray; //getElementsByClassName returns array-like object, but it doesn't have foreach method

if (copyrightTagList != null) {
for (var i = 0; i < copyrightTagList.children.length; i++) {
copyrightTags.push("series:" + copyrightTagList.children[i].getAttribute('data-tag-name'));
}
}
if (characterTagList != null) {
for (var i = 0; i < characterTagList.children.length; i++) {
characterTags.push("character:" + characterTagList.children[i].getAttribute('data-tag-name'));
}
}
if (artistTagList != null) {
for (var i = 0; i < artistTagList.children.length; i++) {
artistTags.push("artist:" + artistTagList.children[i].getAttribute('data-tag-name'));
}
}
if (generalTagList != null) {
for (var i = 0; i < generalTagList.children.length; i++) {
imageTags.push(generalTagList.children[i].getAttribute('data-tag-name'));
}
}
if (metaTagList != null) {
for (var i = 0; i < metaTagList.children.length; i++) {
metaTags.push(metaTagList.children[i].getAttribute('data-tag-name'));
}
}

tags = [copyrightTags, artistTags, characterTags, imageTags, metaTags];
//console.log(tags);
replaceTags(tags);
}});
}

function replaceTags(tags){
console.log("adding tags to page");
var imageTags = tags[3];
for(var i = 0; i < tagsToReplace.length; i++){
var replaced = tagsToReplace[i].substr(0,tagsToReplace[i].indexOf(" "));
var replacement = tagsToReplace[i].substr(tagsToReplace[i].indexOf(" ") + 1);
if(imageTags.indexOf(replaced) != -1){
imageTags[imageTags.indexOf(replaced)] = replacement;
}
}
for(i = 0; i < tagsToRemove.length; i++){
var index = imageTags.indexOf(tagsToRemove[i]);
if(index > -1){
imageTags.splice(index, 1);
}
}
for(i = 0; i < tagsToAdd.length; i++){
imageTags.push(tagsToAdd[i]);
}

//remove tagme type tags
var originalTags = document.getElementById("tags").innerHTML;
originalTags = originalTags.replace("tagme", "");
if (tags[1].length > 0) {
originalTags = originalTags.replace("artist_request", "");
}
if (tags[2].length > 0 || tags[1].length > 0) {
originalTags = originalTags.replace("character_request", "");
}
document.getElementById("tags").innerHTML = originalTags;

//add new tags found
for(i = 0; i < tags.length; i++){
for(var j = 0; j < tags[i].length; j++){
var withSpace = " " + tags[i][j];
document.getElementById("tags").innerHTML += withSpace;
}
}
if(openOriginal){
GM_openInTab(danbooruURL);
}
}

function addButton(){
var separator = document.createTextNode(" | ");
var searchLink = document.createElement("a");
searchLink.innerHTML = "Danbooru tags";
searchLink.href = "#";
links = document.getElementsByTagName("a");
for(var i in links){
if(links[i].innerHTML == "Tag History"){
links[i].parentNode.insertBefore(separator, links[i].nextSibling);
links[i].parentNode.insertBefore(searchLink, links[i].nextSibling.nextSibling);
}
}
searchLink.addEventListener("click", function(){
if(!clicked){
clicked = true;
initialize();
}
});
console.log("added button");
}

addButton();
Lucy_Rose
Fri, Jun 03 '22, 16:31
How exactly do you make the mass uploader accept this booru? The error it shows is "wrong response. Check your posting form URL." But I don't see where I would input/change this. Sorry I'm not very good with coding stuff, thanks in advance.

EDIT: I may just be stupid but the danbooru tag grabber seems to do nothing when I click it, I'm just supposed to click it while looking at an image page right? or is it while uploading or in a sub menu or something
censored
Sat, Jun 04 '22, 01:13
Lucy_Rose said:
How exactly do you make the mass uploader accept this booru? The error it shows is "wrong response. Check your posting form URL." But I don't see where I would input/change this. Sorry I'm not very good with coding stuff, thanks in advance.

EDIT: I may just be stupid but the danbooru tag grabber seems to do nothing when I click it, I'm just supposed to click it while looking at an image page right? or is it while uploading or in a sub menu or something


so the mass upload script that's shown on the upload page never actually worked. the userscript from this thread used to work, up until the capchas were implemented. the script can't do the capchas so it just doesn't work anymore.

as for the danbooru script, make sure you're using the version i posted here most recently and not the old versions earlier in this thread. danbooru changed stuff on their website so the early versions likely fail.

i tested my version of the danbooru script and it still works for me. when you click the Danbooru Tags button that gets added to the page, you'll have to wait a few seconds for the iqdb search to happen. once it has results from iqdb, a new tab should open with the image it thinks is closest. if it doesn't match, you shouldn't save those tags because it copied inccorect tags.

btw I'm much more active on the censoredbooru discord server (there's a link in another thread here). it'll be easier for me to help you there.
Lucy_Rose
Sat, Jun 04 '22, 04:57
I was able to get it working by adding
// @connect iqdb.org
// @connect donmai.us

from the documentation it must be something with my security, the * at the end of the line of yours should be "this site and sub pages will be checked with the user as it pops up" but mine was auto blocking it, so mine is just allowing the whole site ignoring sub pages. Working now, just posting the fix here if someone happens to need it later.
1


Reply | New Topic | Help | Forum Index