this is the code that powers @tinruufu, which happens to include a small but useful danbooru api client as well as a utility for downloading all images from a danbooru search result
you need python 2.7, probably running on a unix-y system like linux or bsd or mac osx or something
there are also some python things you can install with pip install [package]
to make stuff work
completely necessary:
requests
, which we use to hit the danbooru api and download files
optional:
gevent
, for if you want to download files in parallel (it'll work fine without it, but it'll be slower)tweepy
, for tweeting
you can set twitter and danbooru credentials if you like; make a file called
secrets.py
in this directory and make it look something like this:
danbooru_login = 'username'
danbooru_key = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
token_key = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
token_secret = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
app_key = 'AAAAAAAAAAAAAAAAAAAAAAAAA'
app_secret = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
without danbooru credentials associated with a gold account, you won't be able to access images with censored tags
without twitter keys and a file you can read at /usr/share/dict/words
, you
won't be able to tweet
to download all images containing nekomimi and red hair, for example, you would
run python dl.py nekomimi red_hair
files are downloaded to a downloads
directory in the current working
directory
nt.py
is where the business happens; it includes the utilities that the rest
of the stuff uses and will try to tweet when invoked as a script
all arguments are taken as tags to filter by, just like dl.py
a delayed wrapper for nt.py
that takes the same arguments and does the same
thing, but waits a random interval between 0 and 48 hours before doing
anything.