Home

Awesome

Booru

Python bindings for Booru imageboards

<a href="http://sinkaroid.github.io/booru"><img align="right" src="https://cdn.discordapp.com/attachments/952117487166705747/961124440400351232/mataa.png" width="400"></a>


<div align="center">

<a href="https://github.com/sinkaroid/booru/actions/workflows/find_tags.yml"><img src="https://github.com/sinkaroid/booru/workflows/Tags completion/badge.svg"></a> <a href="https://codeclimate.com/github/sinkaroid/booru/maintainability"><img src="https://api.codeclimate.com/v1/badges/c334d91994d1d84b8d7d/maintainability" /></a>

Python bindings for the imageboards. It is takes a much more functionalities to interacts with ease, and featureful. Making your interaction significantly tidier, less of pain, and hopefully will be reusable.

<b> <a href="https://github.com/sinkaroid/booru/blob/master/CONTRIBUTING.md">Contributing</a> • <a href="https://sinkaroid.github.io/booru">Documentation</a> • <a href="https://github.com/sinkaroid/booru/issues/new/choose">Report Issues</a> </b> </div>

Features

Usage

Async context, and it's recommended use asyncio / https://sinkaroid.github.io/booru

Prerequisites

<table> <td><b>NOTE:</b> Python 3.7 or above</td> </table>

Installation

pip install booru

This library vs. the Competition

Features availability for this library

BooruStatusRandomTags blockTags finderGet imagesGacha
GelboorustatusYesYesYesYesYes
DanboorustatusYesYesYesYesYes
Rule34statusYesYesYesYesYes
RealboorustatusYesYesYesYesYes
TbibstatusYesYesYesYesYes
XboorustatusYesYesYesYesYes
SafeboorustatusYesYesYesYesYes
YanderestatusYesYesYesYesYes
LoliboorustatusYesYesYesYesYes
KonachanstatusYesYesYesYesYes
Konachan.netstatusYesYesYesYesYes
HypnohubstatusYesYesYesYesYes
E621statusYesNoNoYesYes
E926statusYesNoNoYesYes
DerpiboorustatusYesNoNoYesYes
FurboorustatusYesNoNoYesYes
ATFboorustatusYesYesYesYesYes
BehoimistatusYesNoNoYesYes
PahealstatusYesNoNoYesYes

Example

search()

Takes parameter (query: str, block: str = "", limit: int = 100, page: int = 1, random: bool = True, gacha: bool = False)

import asyncio
import booru

async def main():
    dan = booru.Danbooru()
    res = await dan.search(query="cat_girl", block="futanari")
    print(res) ## this is <class 'str'>
    print(booru.resolve(res)) ## this is <class 'list'>

asyncio.run(main())

You can also import specific booru client.

from booru import Rule34
some_booru = Rule34()

## do with r34

search_image()

Takes parameter (query: str, block: str = "", limit: int = 100, page: int = 1)

import asyncio
from booru import Rule34

async def main():
    r34 = Rule34()
    img = await r34.search_image(query="cat_girl", block="futanari")
    print(img)

asyncio.run(main())

find_tags()

You want to wildcard or query completion like the browser do?

<center> <table> <tr> <td align="center"><img src="https://cdn.discordapp.com/attachments/1046495201176334467/1050354442966413352/rounded_corners_3.png" width="340px;" alt=""/><br />What browser looks like</td> <td align="center"><img src="https://cdn.discordapp.com/attachments/1046495201176334467/1050354442651836506/rounded_corners_4.png" width="340px;" alt=""/><br />This library also</td> </tr> </table> </center><br>
import asyncio
from booru import Danbooru, resolve

async def main():
    dan = Danbooru()
    find_tags = await dan.find_tags("jeanne") ## arbitrary tags
    wildcard = resolve(find_tags)
    print(wildcard)

asyncio.run(main())

booru.resolve()

You will need this for every object, this library designed to be neat and clean returns, although it must be reparsed to the string first, that's why booru.resolve() exist.

Documentation

The documentation can be found https://sinkaroid.github.io/booru

Legal

This tool can be freely copied, modified, altered, distributed without any attribution whatsoever. However, if you feel like this tool deserves an attribution, mention it. It won't hurt anybody

Licence: WTF.