A Python wrapper for the rule34.xxx API
Project description
Niko's Rule34 Wrapper
[!WARNING] The service this pulls media from is an NSFW service!!
[!IMPORTANT] This is still work in progress!! Bugs WILL show up!!
A python wrapper/downloader for rule34.xxx!!
Features
- CLI Interface - Command-line tool for searching and listing posts from rule34.xxx with customizable tags and limits.
- Unlimited Fetching - Supports fetching unlimited posts by paginating through API results (bypasses the 1000-post per-request limit).
- Pool Support - Fetch posts from specific pools. I don't know of any other wrappers/downloaders that support pools.
tag_infosupport - Supports rule34's tag info stuff. This means that tags can be catagorized by their type (general, artist, character...).
Installation
Prerequisites
- Python 3.8 or higher
- API key and user ID from api.rule34.xxx
Optional for enhanced UI:
- rich
[!NOTE] This should work on Windows. Otherwise, open an issue!
Installation through PyPi (if you're also using this as a library):
pip install nikos-rule34-wrapper rich # rich is optional
Installation through pipx (if you're only using this to download posts and stuff):
pipx install nikos-rule34-wrapper && pipx inject nikos-rule34-wrapper rich # rich is optional
Tested on:
- Linux (Ubuntu)
- MacOS (Tahoe)
- Termux (although some extra setup is done for dependancies)
Usage
Run the CLI tool:
python -m rule34 --tags "-ai_generated -scat -3d kasane_teto" --limit 100 --download --destination /path/to/download/
...or if you installed with pipx, replace python -m rule34 with just rule34 (rule34 --tags "-ai_gener...)
Arguments
--tags(optional): Search tags (e.g., "vocaloid", "sort:score", "-ai_generated"). One of --tags, --pool-id, or --favorites-user-id must be specified.--pool-id(optional): Pool ID to fetch posts from.--favorites-user-id(optional): User ID to fetch favorites from.--limit(optional): Number of posts to fetch (default 200, 0 for unlimited).--download(flag): Enable downloading of posts.--destination(required if downloading): Path to save downloaded files.--reset-credentials(flag): Prompt to re-enter API credentials.
First Run
On first use, you'll be prompted for your API key and user ID. These are stored securely and reused in future runs.
Examples
[!NOTE] If you installed through
pipx, remember to replacepython -m rule34withrule34.
[!IMPORTANT] Some systems use
python3instead ofpython. Try that if this doesn't work. This doesn't apply to those usingpipx!
-
List posts without downloading:
python -m rule34 --tags "kasane_teto sort:score" --limit 50
-
Download unlimited posts:
python -m rule34 --tags "kasane_teto" --limit 0 --download --destination ./downloads # WILL download many files!!! It's okay to terminate with ctrl+C.
-
Reset credentials:
python -m rule34 --tags "kasane_teto sort:score" --reset-credentials --print-posts --taginfo # Will prompt for credentials before listing
-
Fetch posts from a pool:
python -m rule34 --pool-id 12345 --limit 50 --download --destination ./pool_downloads
-
Fetch posts from user favorites:
python -m rule34 --favorites-user-id 4525852 --limit 100
API Reference
from rule34 import Client
client = Client("your_api_key", "your_user_id")
posts = client.list_posts("kasane_teto", limit=100)
for post in posts:
print(post.file_url)
See client.py for full method details.
Contributing
Contributions are welcome!!! PLEASE open an issue or submit a pull request!!!
Planned features
- [ ] Httpx instead of requests
- [ ] Async support
- [x] PyPi package
Published at https://pypi.org/project/nikos-rule34-wrapper/!
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 nikos_rule34_wrapper-1.0.4.tar.gz.
File metadata
- Download URL: nikos_rule34_wrapper-1.0.4.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
609bcf7d7abfbbcb43161617aed98a813064287dc263dda37d692cba5a1bf289
|
|
| MD5 |
4da5d6c57592eb0c33a2ba9962df2e28
|
|
| BLAKE2b-256 |
3f505c0dc348b2ed493ed13bfc87a9d362fb735cad76e0252b730c862c4aa417
|
Provenance
The following attestation bundles were made for nikos_rule34_wrapper-1.0.4.tar.gz:
Publisher:
python-publish.yml on niko-at-chalupa/nikos-rule34-wrapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nikos_rule34_wrapper-1.0.4.tar.gz -
Subject digest:
609bcf7d7abfbbcb43161617aed98a813064287dc263dda37d692cba5a1bf289 - Sigstore transparency entry: 1173399742
- Sigstore integration time:
-
Permalink:
niko-at-chalupa/nikos-rule34-wrapper@e821597cb94666bd8e7ec2fa6f981a9f632b70d0 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/niko-at-chalupa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e821597cb94666bd8e7ec2fa6f981a9f632b70d0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nikos_rule34_wrapper-1.0.4-py3-none-any.whl.
File metadata
- Download URL: nikos_rule34_wrapper-1.0.4-py3-none-any.whl
- Upload date:
- Size: 16.9 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 |
c4e6b0df795d2ae1f927afc934b033dfb8144c7c07e1fc63a562dd800641e2ec
|
|
| MD5 |
3fa4809b8bc90bd9df3c23da9fafddbb
|
|
| BLAKE2b-256 |
11804d4e07e4ccc13e90dcfb974a8ac2eda7e47175962734f4bf16e9287b6310
|
Provenance
The following attestation bundles were made for nikos_rule34_wrapper-1.0.4-py3-none-any.whl:
Publisher:
python-publish.yml on niko-at-chalupa/nikos-rule34-wrapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nikos_rule34_wrapper-1.0.4-py3-none-any.whl -
Subject digest:
c4e6b0df795d2ae1f927afc934b033dfb8144c7c07e1fc63a562dd800641e2ec - Sigstore transparency entry: 1173399792
- Sigstore integration time:
-
Permalink:
niko-at-chalupa/nikos-rule34-wrapper@e821597cb94666bd8e7ec2fa6f981a9f632b70d0 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/niko-at-chalupa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e821597cb94666bd8e7ec2fa6f981a9f632b70d0 -
Trigger Event:
release
-
Statement type: