Derpibooru artist gallery download script

aroddo
My Little Pony - 1992 Edition

Hi,
 
I made a few changes to the download script by X41
 
You now can use the script to download an artist’s gallery (filtered by stuff you exlusively want - or don’t want at all), and keep the download folder for that artist up-to-date. It also skips files you already have, keeping traffic down to a minimum.  
You basically just enter the artist’s name and how many of the result pages you want and the script will create a directory and shove it all inside.
 
Changelist:  
  • Streamlined for faster artist gallery downloads - You basically enter the artist name and go  
  • Predetermined taglist. I basically excluded all the disgusting shit. Personal taste, though. Change the “tags”-String according to your own needs  
  • Creates directory based on artist name in current location. Customize the “newdir”-string according to your own needs  
  • Skips already downloaded images. Unless you keep the original name or the source name doesn’t change, you can use this script to comfortable keep your files up-to-date.  
  • Fixed the “Something went wrong with picture XX” bug. Unless something really fucks up, you shouldn’t see that message again.
     
    See sourcecode here: https://justpaste.it/xb3k
     
    Oh, and you need to install python first, have a derpibooru account and insert your API-key into the script.
     
     
    Cheers!
     
     

 
UPDATE 1.2  

Changes 1.2 (06.01.2017): changed to https  

If you suddenly noticed that the script doesn’t download pics anymore, it’s because derpibooru switched to https.

 
UPDATE 1.1  

Changes 1.1 (01.10.2016):  

- Improved duplicate detection. Script now checks if a file with the same id exists  

(the 7-digit number at the beginning of the filename). Otherwise you would got duplicate downloads  

if tags change.

Background Pony #DCDF
so I’m having issues with this, I got the downloader working but it’s skipping a lot of the files i’m trying to download. I enter the artiest name hooves-art and page numbers 1-4 and it starts up but only downloads 31 images of the 181 i’m trying to get. with the default tag list it won’t get any safe rated images,(I get why) but it only grabs ones tagged as suggestive for some reason. I tested this with “rain-gear” as well using only pages 1-1 and only suggestive tagged show up and it’s downloading images outside of the page range (from page 2,3,ect)  
(all things below are tested with artiest tag rain-gear and only page 1)  
other things I tried are removing the -safe tag and got only safe and suggestive images,  
replacing -safe with explicit but this just makes the program close after “downloading page 1”, (I think it says there are no images found)  
and having “-safe,explicit,rest of default tags here, but get the same result as before.  
and finally if I remove all the tages so the line is like this  
tags = (“artist:” + artist + “”).split(”,”)  
it only gets 16 images all of them rated safe and suggestive…  
hope this makes sense and you can help me.
aroddo
My Little Pony - 1992 Edition

@Background Pony #F7B0
 
hi,  
I just tested the script using hooves-art and it downloaded 185 out of 181 pictures (yup.no idea why.) without a problem.
 
However, if I use an incorrect API string, I get the same results as you do.
 
So:  
  1. Go to https://derpibooru.org/users/edit and copy the API key.  
    It’s bold part of this line:  
    Your API key is abcdefghijklmnopq_xyz - you can use this to allow API consumers to access your account.  
  2. Paste the key in line 42 of the script.  
    It should look like this:  
    key = “abcdefghijklmnopq_xyz
     
    Make sure there are no leading or trailing spaces.
Joey
Dawnsong - Derpi Supporter
Lunar Supporter - Helped forge New Lunar Republic's freedom in the face of the Solar Empire's oppressive tyrannical regime (April Fools 2023).
Flower Trio - Helped others get their OC into the 2023 Derpibooru Collab.
Roseluck - Had their OC in the 2023 Derpibooru Collab.
A Lovely Nightmare Night - Celebrated the 12th anniversary of MLP:FIM!
Cool Crow - "Caw!" An awesome tagger
Tree of Harmony - Drew someone's OC for the 2022 Community Collab
Elements of Harmony - Had an OC in the 2022 Community Collab
Non-Fungible Trixie -
Verified Pegasus - Show us your gorgeous wings!

PM me your cute OCs
@aroddo  
Weird, the site’s only showing 181 images under that tag. I also forced a re-index just to make sure that there’s not a miscount or an image missing from the index, but still only 181. No idea where you’d get 185 from.
aroddo
My Little Pony - 1992 Edition

@Joey  
oh, it gets even better:  
Sometimes I get twice the amount of hits, even though I use the exact same request!  
That’s because the search.json request doesn’t deliver consistent answers.
 
I’ll have to check where the extra 4 pictures come from, because that’s a whole seperate issue …
 
@Heavens_Rejected  
Space is important!  
full  
glad you got it running. how do you like it so far? :)
DividedByZero
The End wasn't The End - Found a new home after the great exodus of 2012

Hey guys, if you prefer the short numerical download names, here is what I did:
 
first you write
 
import re
 
into Line 41
 
then you change  
newLink = (“http:” + data[x:y])
 
in Line 110 into  
newLink = re.sub(“(?=_)(.*?)(?=.)”, “”, (“http:” + data[x:y]))
 
 
What it does is, that it will perform a regular expression search into the Link, and substract the <id>_tags.<extension> into <id>.<extension>.
aroddo
My Little Pony - 1992 Edition

Hi,
 
I updated the script a bit for improved duplicate detection.  
Now, if you attempt to download a file where another file with the same id already exists, the script will skip it.
 
Get the script at the same place as before: https://justpaste.it/xb3k
aroddo
My Little Pony - 1992 Edition

@Smudge_Proof  
sure.  
check out line 72 in the script:
 
tags = ("artist:" + artist + ",-hoof fetish ,-amputee ,-birth ,-crush fetish ,-diaper ,-grimdark ,-grotesque ,-guro ,-impossibly large belly ,-inflation ,-merch sexploitation ,-morbidly obese , -scat ,-gay ,-solo male ,-vore").split(",")
 
The .split method breaks up a string into an array by a given delimiter character (in this case a comma).
 
Just make sure that the tags array only contains the keywords you like and you are set.  
e.g. if you want all safe berry punch animated screencaps, then you replace that line with something like this:  
tags = ("berry punch, animated, safe, screencap").split(",")
 
twiddle a bit with the code and you can easily fill the tags-array by command prompt.
Interested in advertising on Derpibooru? Click here for information!
Ponies Online! - April 13-14

Help fund the $15 daily operational cost of Derpibooru - support us financially!

Syntax quick reference: **bold** *italic* ||hide text|| `code` __underline__ ~~strike~~ ^sup^ %sub%

Detailed syntax guide