Confuzu/CivitAI_Image_grabber

Enhancement request: Download off a tag or image search

Nobrumski opened this issue · 10 comments

Is there any way to add support so you could pull images off a specific tag or search result?

For example clicking on the Armor tag gives you this link.
https://civitai.com/images?tags=5169&view=feed

Search results for Armor give you this link
https://civitai.com/search/images?sortBy=images_v3&query=armor

The issue of course is Civitai is pretty bad with tagging so not everything that shows up in search has the appropriate tag.

hi good idea but there a 3 problems the image API has no tag query, the tag API gives only Models with the Armor Tag and 10 images for the Model and the Model API with tags has again only the 10 Model images.

I will see if I can find a way around these 3 problems.

Thanks, wasn't sure if it supported it or what limitations the API has. I know there was another scraper out there that had some interesting features like filtering by likes, but don't know how well it works with the current api. Looking for my enhancement request over there helped me stumble across yours.

https://github.com/hassan-sd/civitai-image-scraper

i may have found a way but this is something i don´t know what is better. Exact words or subtring to get more images , but it can happen that there are pictures that are not wanted.

Exact matches are searched for the entire word. If "armor" is searched for, but the prompt only contains "armored", that image would not be recognized as a match because there is no exact match.
or
The substring method
Examples that are recognized as a match:
Armored Vehicle: "armor" is part of "Armored", this is recognized as a match.
Knight's Armor: "armor" is directly in the text, so this is a clear match.
The armorial bearings: Despite the additional ending "ial", "armor" is recognized

Hmm, yeah tough call especially if pulling from the prompt details. I think I would have to say the first option, exact match. Otherwise you may end up with only a handful of images you actually want. The API seems spotty at best sometimes so getting exact match I think would be the better result.

The second option might work ok if the filters, like image scraper has, are implemented. This way you could search armor and only return the results with most reactions so more likely to get better results along a wider spectrum. Also worst case you can run the query multiple times with the same word. I am guessing since haven't tried it yet, but if you run the same word multiple times you may get more and more results since image grabber tracks what it has downloaded? Or will it only return the same results and detect it has been run before?

Also there is always option C which is add both ways with the option to select similar to image quality or username vs model.

Just in case you didn't see, not sure what changed, and seems to be working, but Civitai updated their API so not sure what they added.

I'm still working on it but it's taking longer than expected

I appreciate it. It was more a thought that this would be nice if it was possible.

Work is done thanks for the idea. Please try it and say what you think.

Thanks, I tried HOLDING WEAPON, and tag#161864, even with prompt filter off it found no results and there should be plenty.
https://civitai.com/images?tags=161864&view=feed. I also tried HOLDING_WEAPON in case the space was the issue.

It did work with weapon though so it looks like it is only pulling model tags since the first thing it pulled was model 310272 and 342528 before I cancelled it. One thing which I don't know if it is possible is it creates sub-folders for the model so in this case model 310272 and 342528, but it doesn't pull the naming in like it would if you grabbed by model ID. I don't know if there is a way to do this on folder creation.

I tried Dungeon & Dragons which worked when I used their exact tag,dungeons %26 dragons, but for some reason their tag one-piece swimsuit didn't.
https://civitai.com/tag/dungeons%20%26%20dragons
https://civitai.com/tag/one-piece%20swimsuit

I am guessing the model tags are handled differently than the image tags. I didn't realize this when making the suggestion, and it didn't help I used armor which is used in both cases. There seem to a be a lot more image tags than model tags. Not sure if there is a way to incorporate the image tag as a fourth option if you get a chance. May also want to change the label to model tag search to stop potential issue reports down the road.

I didn't even think about the API change when I posted this. The update to address the API changes fixed it so one-piece swimsuit works now.