Python bindings for Derpibooru's API
License: Simplified BSD License
Version: 0.9.0
- High-level abstraction over Derpibooru's REST API
- Parameter chaining for ease of manipulation
- Syntactic sugar for queries, e.g., "query.score >= 100" compiling to "score.gte:100"
- Design focusing on iterables and lazy generation for network efficiency
- python2.7 or newer
- requests
This is a fork of the DerPyBooru package; it is meant to be a drop in replacement for the modules in that package.
$ pip install derpybooru-nullforce
$ pip3 install derpybooru-nullforce
$ pydoc derpibooru
$ pydoc3 derpibooru
from derpibooru import Search
for image in Search():
id_number, score, tags = image.id, image.score, ", ".join(image.tags)
print("#{} - score: {:>3} - {}".format(id_number, score, tags))
from derpibooru import Search
for image in Search().query("rarity", "twilight sparkle"):
print(image.url)
from derpibooru import Search
# This is only an example and shouldn't be used in practice as it abuses
# Derpibooru's licensing terms
for image in Search().ascending().limit(None):
id_number, score, tags = image.id, image.score, ", ".join(image.tags)
print("#{} - score: {:>3} - {}".format(id_number, score, tags))
from derpibooru import Search, sort
for post in Search().sort_by(sort.RANDOM):
print(post.url)
from derpibooru import Search, sort
top_scoring = [post for post in Search().sort_by(sort.SCORE).limit(100)]
from derpibooru import Search, sort
params = Search().sort_by(sort.SCORE).limit(100).parameters
top_scoring = Search(**params)
top_animated = top_scoring.query("animated")
from derpibooru import Search, query
q = {
"wallpaper",
query.width == 1920,
query.height == 1080,
query.score >= 100
}
wallpapers = [image for image in Search().query(*q)]
from derpibooru import Search, user
key = "your_api_key"
for post in Search().key(key).watched(user.ONLY):
id_number, score, tags = post.id, post.score, ", ".join(post.tags)
print("#{} - score: {:>3} - {}".format(id_number, score, tags))
0.9.0
- Update sort to include: first_seen_at, tag_count, and updated_at
- Deprecated Search() methods that appear to be no longer supported by derpibooru:
- faves()
- uploads()
- upvotes()
- watched()
0.8.0
- Updated sort to include wilson and width