Skip to main content

Feature-rich HTML parser for rule34.xxx (no API). Search posts, autocomplete tags, get random images.

Project description

rule34html

A friendly, zero-API HTML parser for rule34.xxx built in Python. It scrapes the website’s public HTML (no API calls) to provide:

  • Search posts by tags
  • Get a single random post from tags
  • Get multiple random posts from tags
  • Tag autocomplete
  • Get full-size image/file URL
  • Download images
  • Both sync and async clients with context manager support (with/async with)
  • Polite rate-limiting + retries
  • Handy CLI: r34

⚠️ For adults and legal use only. This package just parses public HTML from rule34.xxx. It does not use the site's JSON/XML API endpoints.

Quick start

pip install rule34html

Synchronous Client

from rule34html import Rule34Client

# Use the client as a context manager to ensure it's closed properly
with Rule34Client() as client:
    # Search for posts
    posts = client.search_posts(["blue_eyes", "1girl"], page=0)
    print(f"Found post: {posts[0].id}, Image URL: {posts[0].image_url}")

    # Get a single random post
    post = client.random_post(["blue_eyes"])
    print(f"Random post: {post.id}, Image URL: {post.image_url}")

    # Get 5 random posts
    random_posts = client.random_posts(["solo"], count=5)
    print(f"Got {len(random_posts)} random posts.")
    for p in random_posts:
        print(f" - Post {p.id}")

Asynchronous Client

import asyncio
from rule34html import AsyncRule34Client

async def main():
    async with AsyncRule34Client() as client:
        # Get 5 random posts concurrently
        random_posts = await client.random_posts(["solo"], count=5)
        print(f"Got {len(random_posts)} random posts asynchronously.")
        for p in random_posts:
            print(f" - Post {p.id}, Image URL: {p.image_url}")

if __name__ == "__main__":
    asyncio.run(main())

CLI

# Search posts
r34 search "blue_eyes 1girl" --page 0 --limit 10

# Random post by tags
r34 random "blue_eyes" --open

# Autocomplete tags
r34 autocomplete blu --limit 15

# Download a post by id
r34 download --id 1234567 --out ./downloads

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

rule34html-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

rule34html-0.1.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file rule34html-0.1.1.tar.gz.

File metadata

  • Download URL: rule34html-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rule34html-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0f1abe129f8807d16437b8c5dc69dd8632799d708f9b940a30f0041b6995b425
MD5 46051e0b96dcb5d33c8ae731cce63b2a
BLAKE2b-256 bcecb90ee58bcecd81e5fe13bfe7de32eeefd2c77a8a6b9e413d7a5602f1c3c1

See more details on using hashes here.

File details

Details for the file rule34html-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rule34html-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rule34html-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba87d2d9c6665d3bafebeb2d125a701dd2b2d374c9aee3756a427ea3cf9420d5
MD5 db4210d72bc919a1a4f30913dff60943
BLAKE2b-256 a2c87590fe341b87dcb972c734fce15cb35138b7c48874161e14f5fba0be4a9f

See more details on using hashes here.

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