Skip to main content

PyRule34

This is a lightweight asynchronous library for the rule34 API

English · Русский

GitHub - License
PyPI - Version PyPI - Downloads
Python - Version

Table of Contents

Getting Started

Install using PyPI
pip install -U pyrule34

or

Clone the repository
git clone https://github.com/Hypick122/pyrule34.git
  1. Install the required Python packages:
pip install -U aiohttp, beautifulsoup4, lxml
  1. Create a .py file and import the required libraries:
import asyncio
from pyrule34 import AsyncRule34

Usage

AsyncRule34 can be used as a context manager:
```python
#example
async def main():
    async with AsyncRule34() as r34:
        get_posts = await r34.get_posts(4931536)
        
        print(get_posts[0].tags)
        
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Search

Search for posts using specified inclusion and exclusion tags.

Returns a list.

Parameters:

  • tags - The include tags
  • exclude_tags - The exclude tags (default: None)
  • limit - The (maximum) limit to get posts. Maximum 1000 per one request (default: 100)
  • page_id - The page number (default: 0)
search = await r34.search(tags=["neko"], exclude_tags=["rating:general"], page_id=2, limit=1)

Get post

Retrieve post(s) by ID or MD5 hash.

Returns a list.

Parameters:

  • posts_id: The list of IDs posts or post ID
  • md5: The MD5 hash of the post (default: None)
get_posts = await r34.get_posts(4931536)

Comments on the post

Get comments by post ID.

Returns a list.

Parameters:

  • post_id: The ID of the post
get_post_comments = await r34.get_post_comments(4153825)

Random post

Get a random post.

Returns a dict.

get_random_post = await r34.get_random_post()

Pool

Get Pool by ID.

Returns a list.

Parameters:

  • cid: Pool ID
  • offset: offset (default: 0) | 1 page - 45
get_pool = await r34.get_pool(29619)

User favorites

Get user's favorites by ID.

Returns a list.

Parameters:

  • user_id: user ID
  • offset: offset (default: 0) | 1 page - 50
favorite = await r34.users.favorites(2993217)

Top 100 characters and tags

Get the top 100 characters or tags.

Returns a list.

top_character = await r34.top_characters()
top_tags = await r34.top_tags()

Top users

Get the top 10 best users by tags, comments, etc.

Returns a list.

taggers = await r34.stats.taggers()
favorites = await r34.stats.favorites()
commenters = await r34.stats.commenters()
forum_posters = await r34.stats.forum_posters()
image_posters = await r34.stats.image_posters()
note_editors = await r34.stats.note_editors()

Metadata

Release files for pyrule34test 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pyrule34test 2.0.1
File Interpreter ABI Platform
pyrule34test-2.0.1-py3-none-any.whl Python 3 none any Details

Release files / pyrule34test-2.0.1-py3-none-any.whl

Download URL pyrule34test-2.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33cc491ed8202d6530c2dbc44c2ce8493b1e936d243af65a49799732ee67109d
BLAKE2b-256 checksum
How to use checksums
971ea2c505e7467354b8f3fbf5ffe233b0d05a2901306070dada362b7efce73e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

2.0.1 This release

1 release file

2.0.0

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page