Asynchronous API for downloading images, tags, and metadata from image board sites (e.g., Danbooru, Safebooru, Yandere). Ignore the downloaded files.
Project description
WaifuBoard
English README | 简体中文 README | 繁體中文 README | 日本語 README | 한국어 README
Asynchronous API for downloading images, tags, and metadata from image board sites (e.g., Danbooru, Safebooru, Yandere). Ignore the downloaded files.
Installation
pip install waifuboard
Requires: Python >= 3.10
Supported platforms and features
| Platform | Posts (download) | Pools (download) |
|---|---|---|
| Danbooru | ✅ | ✅ |
| Safebooru | ✅ | ❌ |
| Yandere | ✅ | ✅ |
| Other platforms | ... | ... |
Usage
Create a client (e.g., DanbooruClient) and call the download method of the corresponding component, such as client.posts.download(...) or client.pools.download(...). For parameters, please refer to the download method docstrings in the code.
import asyncio
import logging
from waifuboard import DanbooruClient
async def main():
# Create a client, which will be used to interact with the API
client = DanbooruClient(
directory="./downloads", # The root directory of the storage files for the current client platform
logger_level=logging.INFO, # The log level
base_url=None, # Automatically set a URL prefix (or base url) on every request emitted if applicable
proxies="http://127.0.0.1:7897", # Dictionary mapping protocol or protocol and host to the URL of the proxy (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to be used on each Request <Request>. If a single string is provided, it will be used for both http and https. It can also be a tuple of such values; an element will be randomly selected per request. When not provided and trust_env is True, the process environment's proxy settings are captured as the default, giving an effective priority of request > session > env
retries=5, # Configure a number of times a request must be automatically retried before giving up
max_attempt_number=3, # Default outer retry budget (tenacity-level) for request methods. Used when a request method does not pass its own max_attempt_number. If still None at request time, the underlying call falls back to a single attempt
rate_limit=10.0, # Maximum requests per second
timeout=None, # Default timeout configuration to be used if no timeout is provided in exposed methods
)
# Download posts
await client.posts.download(
limit=200,
all_page=True,
tags="k-on!",
save_raws=True,
save_tags=True,
)
# Download pools
await client.pools.download(
limit=1000,
query={
'search[name_matches]': 'k-on!',
},
all_page=True,
save_raws=True,
save_tags=True,
)
if __name__ == "__main__":
asyncio.run(main())
If this project is helpful to you, a small star would be the unwavering motivation for me to keep the project open-source.
Download directory structure
Directory tree:
{directory}/
└─ {Platform}/
└─ {Component}/
└─ task/
├─ images/
│ └─ ...
├─ tags/
│ └─ ...
└─ raws/
└─ ...
where task is the unique identifier for the download task (e.g., post ID, pool ID).
Contributing
Contributions are welcome. To add new platforms or features:
-
Architecture
- Platforms should inherit from
waifuboard.booru.Booru(Base Client) and set the appropriatebase_urland components. - Features/endpoints (e.g., Posts, Pools) should inherit from
waifuboard.booru.BooruComponent(Base Component) and implement thedownload(...)interface consistent with existing platforms. - Reuse helpers from
Booru(e.g.,concurrent_fetch_page,concurrent_download_file).
- Platforms should inherit from
-
GitHub workflow
- Fork this repository to your account.
- Create a new branch for your change:
git checkout -b feat/<short-name>. - Implement your platform/component and add minimal docs in this README.
- Run a quick local test to ensure basic functionality works.
- Commit and push your branch:
git push origin feat/<short-name>. - Open a Pull Request to
mainwith a concise description (what/why/how to test).
Guidelines
- Keep public APIs consistent with existing ones (method names, parameters, return types).
- Add docstrings to new methods, especially
download(...)parameters and behavior. - Follow the existing code style and logging patterns.
- Avoid breaking changes; if unavoidable, call them out clearly in the PR.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waifuboard-1.0.10.tar.gz.
File metadata
- Download URL: waifuboard-1.0.10.tar.gz
- Upload date:
- Size: 183.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
621fb51fa2e4e11a2db623790f3d3d85003ed5f00c481a680108318787ec3514
|
|
| MD5 |
2f76449cad3d67ffe65fd5de0286b185
|
|
| BLAKE2b-256 |
38f4cbb7a851744f4af053bd6520c71ac44a199e8f16b68cbc1dfbbcff380b59
|
Provenance
The following attestation bundles were made for waifuboard-1.0.10.tar.gz:
Publisher:
python-publish.yml on 2513502304/WaifuBoard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
waifuboard-1.0.10.tar.gz -
Subject digest:
621fb51fa2e4e11a2db623790f3d3d85003ed5f00c481a680108318787ec3514 - Sigstore transparency entry: 1441124698
- Sigstore integration time:
-
Permalink:
2513502304/WaifuBoard@51a528afee5fcf584a5cc08235dce2a8a3a46c22 -
Branch / Tag:
refs/tags/v1.0.10 - Owner: https://github.com/2513502304
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@51a528afee5fcf584a5cc08235dce2a8a3a46c22 -
Trigger Event:
release
-
Statement type:
File details
Details for the file waifuboard-1.0.10-py3-none-any.whl.
File metadata
- Download URL: waifuboard-1.0.10-py3-none-any.whl
- Upload date:
- Size: 70.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
375531e0b967244cc706d95f90459fec0e31796918bd1b05dad146a80c266df1
|
|
| MD5 |
09c6967e0af64df56c08425bde408661
|
|
| BLAKE2b-256 |
d490dc26d3ffd949b4579bae9690985bc65387f260b440513af1bce1b6c8b417
|
Provenance
The following attestation bundles were made for waifuboard-1.0.10-py3-none-any.whl:
Publisher:
python-publish.yml on 2513502304/WaifuBoard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
waifuboard-1.0.10-py3-none-any.whl -
Subject digest:
375531e0b967244cc706d95f90459fec0e31796918bd1b05dad146a80c266df1 - Sigstore transparency entry: 1441124774
- Sigstore integration time:
-
Permalink:
2513502304/WaifuBoard@51a528afee5fcf584a5cc08235dce2a8a3a46c22 -
Branch / Tag:
refs/tags/v1.0.10 - Owner: https://github.com/2513502304
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@51a528afee5fcf584a5cc08235dce2a8a3a46c22 -
Trigger Event:
release
-
Statement type: