A fast Python API wrapper for rule34 image board
Project description
rule34scraper
A fast Python API wrapper for booru-style image boards using selectolax (Lexbor engine).
Installation
pip install rule34scraper
Usage
Basic Usage
from rule34scraper import R34Client
with R34Client() as client:
# Search posts by tags
posts, tags = client.get_posts(tags="landscape", page=1)
for post in posts:
print(f"ID: {post.id}, Score: {post.score}, Rating: {post.rating}")
# Get post details
details = client.get_post_details(posts[0].id)
print(f"Image: {details.image_url}")
print(f"Size: {details.width}x{details.height}")
# Download image
client.download_post(details, directory="downloads/")
Custom Base URL
from rule34scraper import R34Client
# Use a different booru site
client = R34Client(
base_url="https://example.com/index.php",
posts_per_page=42,
timeout=60.0,
)
# Custom headers
client = R34Client(
base_url="https://example.com/index.php",
headers={"Cookie": "session=abc123"},
)
Async Client
import asyncio
from rule34scraper import AsyncR34Client
async def main():
async with AsyncR34Client() as client:
posts, tags = await client.get_posts(tags="portrait", page=1)
details = await client.get_post_details(posts[0].id)
print(f"Image: {details.image_url}")
asyncio.run(main())
User Profiles
with R34Client() as client:
profile = client.get_user_profile("username")
print(f"User: {profile.username} (ID: {profile.id})")
print(f"Level: {profile.level}")
print(f"Posts: {profile.post_count}")
print(f"Favorites: {profile.favorite_count}")
Models
Post- Thumbnail entry from search resultsPostDetails- Full post metadata (image URL, dimensions, tags, comments)Tag- Tag with name, count, and typePostComment- User comment on a postUserProfile- User profile with stats and recent posts
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
base_url |
str | https://rule34.xxx/index.php |
Base URL for the API |
timeout |
float | 30.0 | Request timeout in seconds |
posts_per_page |
int | 42 | Posts per page for pagination |
headers |
dict | Browser-like headers | Custom HTTP headers |
max_retries |
int | 5 | Max retries for rate limits (429) |
License
MIT
Project details
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 rule34scraper-1.0.2.tar.gz.
File metadata
- Download URL: rule34scraper-1.0.2.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fab2fc3498b451afe43ad8eb3e1731673f3b1a53c682392af457ef285d0ade5
|
|
| MD5 |
32c9f1abfcfc3ccc5d5ba0355a83cca8
|
|
| BLAKE2b-256 |
2dcc3f221bda1e1c864c7d432f84d16dfaf7a36376c8cc90f70b24be5306f5a9
|
Provenance
The following attestation bundles were made for rule34scraper-1.0.2.tar.gz:
Publisher:
python-publish.yml on whatimdoingwithmylife-sudo/rule34scraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rule34scraper-1.0.2.tar.gz -
Subject digest:
9fab2fc3498b451afe43ad8eb3e1731673f3b1a53c682392af457ef285d0ade5 - Sigstore transparency entry: 814969593
- Sigstore integration time:
-
Permalink:
whatimdoingwithmylife-sudo/rule34scraper@2221233d9ec50339a725f98d63ddc3fc38598d29 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/whatimdoingwithmylife-sudo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2221233d9ec50339a725f98d63ddc3fc38598d29 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rule34scraper-1.0.2-py3-none-any.whl.
File metadata
- Download URL: rule34scraper-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.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 |
5771257855a061117781a6dc0add7c61fe9545f6816516b38f0410cd07b9ead3
|
|
| MD5 |
193ec98e266887075add03cca8951f02
|
|
| BLAKE2b-256 |
3f9e40330afdb543dd359d40c260f800598868ddf56c0014496e097eebf2a1b2
|
Provenance
The following attestation bundles were made for rule34scraper-1.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on whatimdoingwithmylife-sudo/rule34scraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rule34scraper-1.0.2-py3-none-any.whl -
Subject digest:
5771257855a061117781a6dc0add7c61fe9545f6816516b38f0410cd07b9ead3 - Sigstore transparency entry: 814969597
- Sigstore integration time:
-
Permalink:
whatimdoingwithmylife-sudo/rule34scraper@2221233d9ec50339a725f98d63ddc3fc38598d29 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/whatimdoingwithmylife-sudo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2221233d9ec50339a725f98d63ddc3fc38598d29 -
Trigger Event:
release
-
Statement type: