Skip to main content

Library for retrieving posts and tags from rule34.paheal.net

Project description

Rule34 posts wrapper

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

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

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

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

Rule34 Posts Wrapper-0.1.1.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

Rule34_Posts_Wrapper-0.1.1.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file Rule34 Posts Wrapper-0.1.1.1.tar.gz.

File metadata

  • Download URL: Rule34 Posts Wrapper-0.1.1.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for Rule34 Posts Wrapper-0.1.1.1.tar.gz
Algorithm Hash digest
SHA256 37059a2554f82280fc1a0506f93066b906dd89a382c715df1ae6ce6f5261d156
MD5 46ee68728b31ed0480c11fd78584cd9e
BLAKE2b-256 c0bd2375b0ed6cfc968d3670794b8262730391893581d2bfa21b6275232ad23f

See more details on using hashes here.

File details

Details for the file Rule34_Posts_Wrapper-0.1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Rule34_Posts_Wrapper-0.1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b1746ceabc90d5df08d6b3efe8d676810d5ea0116d1b7bb6a36aea0f20901ce8
MD5 d6917729e6874808d4bb51bcf26d0656
BLAKE2b-256 cd5fe6e829be70e80a34a037677aa999dab22c2c2dca79ed64e7c82d316db568

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