No description
This repository has been archived on 2026-07-30. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
2023-03-12 02:10:42 +05:00
.github/workflows Changed workflow names 2023-02-06 21:09:16 +05:00
src/rule34_posts_wrapper Bump version to 0.1.1.1 2023-01-28 09:48:20 +05:00
tests Refixed imports 2022-10-14 00:46:44 +05:00
.gitignore Added cov.xml to .gitignore 2022-10-14 15:15:29 +05:00
.pre-commit-config.yaml Removed check-yaml hook 2022-10-14 01:06:54 +05:00
cover.png Added cover for readme 2023-02-07 18:01:08 +05:00
LICENSE Added pre-commit, so all files formatted well 2022-10-13 19:42:56 +05:00
README.md Added support methods 2023-03-12 02:10:42 +05:00
setup.py Fixed setup.py long_description 2022-10-14 01:14:15 +05:00
tox.ini Changed tag for faster test 2022-10-14 00:46:13 +05:00

Rule34 posts wrapper

GitHub Workflow Status (branch) Codecov GitHub Repo stars Code style: black PyPI - Downloads

Rule34 Posts Wrapper

This is a rule34.paheal.net wrapper that turns your query into an iterable list of posts with the most important information about them.

Consider supporting this project. You can buy me a cup of tea (I don't drink coffee).

Installation

To install:

pip install rule34-posts-wrapper

Or for development/testing purposes, clone and run:

pip install -e .[development]
pre-commit install

Usage

PostsWrapper

To start import PostsWrapper and call it:

from rule34_posts_wrapper import PostsWrapper

posts = PostsWrapper(['your', 'query', 'here'])[0].file

Note that there is no authentication for now so you can't use more than three tags in your query.

Now you can iterate the posts in cycle:

for post in posts:
    print(str(post.file) + " - " + " ".join(post.tags)) # Do whatever you want with Post object

Also you can just interact with it like list

first_post = posts[0]
print(str(first_post.thumbnail))

Note that all URLs are urllib3.util.Url, call str(posts[x].link) to convert it to str.

TagsWrapper

Like PostsWrapper, TagsWrapper provides you iterable list of Tag's:

from rule34_posts_wrapper import TagsWrapper

tags = TagsWrapper("Your_Query_Here")

print(f"Found {len(tags)} tags:", end="\n\n")
for tag in tags:
    print(f"Tag: {tag.name}, Count: {tag.count}")

It uses rule34.paheal.net autocomplete that helps you find tags by it's starting substring.

Testing

To run all tests, just use this command:

tox -e py