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.9
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
from waifuboard import DanbooruClient
async def main():
# Create a client, which will be used to interact with the API
client = DanbooruClient(
max_clients=8, # The maximum number of clients to create, which is used to limit the upper limit of the global concurrent request count. If it is None or a non-positive number, the limit is not applied
directory="./downloads", # The root directory for storing files of the current client platform
proxy_url="http://127.0.0.1:7890", # The URL used to connect to the proxy server. The scheme must be one of "http", "https", "socks5", "socks5h", and the form is {scheme}://{[username]:[password]@}{host}:{port}/ or {scheme}://{host}:{port}/, for example "http://127.0.0.1:8080/"
proxy_auth=None, # Any proxy authentication information, in the format of a two-tuple of (username, password). Can be bytes type or str type containing only ASCII characters. Note: The auth parameter parsed from proxy_url is used first. If no auth is parsed from proxy_url and proxy_auth is not None, the proxy_auth parameter is used to add authentication credentials to proxy_url
proxy_headers=None, # Any HTTP header information for proxy requests. For example, {"Proxy-Authorization": "Basic <username>:<password>"}
proxy_ssl_context=None, # The SSL context used to verify the connection to the proxy server. If not specified, the default httpcore.default_ssl_context() is used
max_connections=100, # The maximum number of concurrent connections that can be established
max_keepalive_connections=20, # The number of long connections that can be maintained below this value. This value should be less than or equal to max_connections
keepalive_expiry=30.0, # The time limit for idle long connections (in seconds)
max_attempt_number=5, # The maximum number of attempts
default_headers=True, # Whether to set default browser headers
logger_level=logging.INFO, # The log level
)
# 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,concurrent_save_raws,concurrent_save_tags).
- 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-0.1.8.tar.gz.
File metadata
- Download URL: waifuboard-0.1.8.tar.gz
- Upload date:
- Size: 121.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
287f9dfcbbc523f68f5ca6e3d7bf760c77a6063f4c7869aafcc82599937536ac
|
|
| MD5 |
a60250716901771501d1b11048e22519
|
|
| BLAKE2b-256 |
0d0a2c563ea759e03ad0dad3240764d20307a298d81d05cc2d8184c58a59a002
|
Provenance
The following attestation bundles were made for waifuboard-0.1.8.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-0.1.8.tar.gz -
Subject digest:
287f9dfcbbc523f68f5ca6e3d7bf760c77a6063f4c7869aafcc82599937536ac - Sigstore transparency entry: 813709408
- Sigstore integration time:
-
Permalink:
2513502304/WaifuBoard@b3739a24e45b29d99ee0ef1ee3f8ac43ad52b537 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/2513502304
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@b3739a24e45b29d99ee0ef1ee3f8ac43ad52b537 -
Trigger Event:
release
-
Statement type:
File details
Details for the file waifuboard-0.1.8-py3-none-any.whl.
File metadata
- Download URL: waifuboard-0.1.8-py3-none-any.whl
- Upload date:
- Size: 56.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
838bf66b4d0ed3a027c3c5b05be4158cf7556bbfdf03e29ea74a43f4270eab9f
|
|
| MD5 |
efde42e354bbc786c7228c9d0f167f13
|
|
| BLAKE2b-256 |
432187832a62fc495048c77a87096869e5e5b34673c6c68a2c10e374bebe9519
|
Provenance
The following attestation bundles were made for waifuboard-0.1.8-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-0.1.8-py3-none-any.whl -
Subject digest:
838bf66b4d0ed3a027c3c5b05be4158cf7556bbfdf03e29ea74a43f4270eab9f - Sigstore transparency entry: 813709409
- Sigstore integration time:
-
Permalink:
2513502304/WaifuBoard@b3739a24e45b29d99ee0ef1ee3f8ac43ad52b537 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/2513502304
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@b3739a24e45b29d99ee0ef1ee3f8ac43ad52b537 -
Trigger Event:
release
-
Statement type: