Skip to main content

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_info support - Supports rule34's tag info stuff. This means that tags can be catagorized by their type (general, artist, character...).

Installation

Prerequisites

Optional for enhanced UI:

  • rich

[!NOTE] This will get uploaded on PyPi in the future!!

[!NOTE] This should work on Windows. Otherwise, open an issue!

Installation through PyPi:

pip install nikos-rule34-wrapper

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/

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

  • 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

nikos_rule34_wrapper-1.0.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nikos_rule34_wrapper-1.0.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file nikos_rule34_wrapper-1.0.3.tar.gz.

File metadata

  • Download URL: nikos_rule34_wrapper-1.0.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nikos_rule34_wrapper-1.0.3.tar.gz
Algorithm Hash digest
SHA256 65547a9ada19c220d57c678081a3bb9ec8df1f770205efa99b27fa3bd7947722
MD5 d6a55aeb6f3b8b21212ea4c41da7856f
BLAKE2b-256 66a4a9c2cc4fc042577b247b606b38e8f71a39fafa33fc7f05fde7f264dc9b38

See more details on using hashes here.

Provenance

The following attestation bundles were made for nikos_rule34_wrapper-1.0.3.tar.gz:

Publisher: python-publish.yml on niko-at-chalupa/nikos-rule34-wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nikos_rule34_wrapper-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nikos_rule34_wrapper-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 730ff589b77fde057087411448739b41098ef30b259c06b9acd6227d2f5c6995
MD5 adfc13c2b03de7e78c6ecf9f54691700
BLAKE2b-256 4f82e53975e21a59061d4d85b4693fd46af3f4a88a0ce1872b4c1d1a8690730e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nikos_rule34_wrapper-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on niko-at-chalupa/nikos-rule34-wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page