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.
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
Metadata
Release files for Rule34-Posts-Wrapper 0.1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Rule34 Posts Wrapper-0.1.1.1.tar.gz | 8.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Rule34_Posts_Wrapper-0.1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.3 kB
Release files / Rule34 Posts Wrapper-0.1.1.1.tar.gz
| Download URL | Rule34 Posts Wrapper-0.1.1.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37059a2554f82280fc1a0506f93066b906dd89a382c715df1ae6ce6f5261d156
|
|
BLAKE2b-256 checksum How to use checksums |
c0bd2375b0ed6cfc968d3670794b8262730391893581d2bfa21b6275232ad23f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / Rule34_Posts_Wrapper-0.1.1.1-py3-none-any.whl
| Download URL | Rule34_Posts_Wrapper-0.1.1.1-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1746ceabc90d5df08d6b3efe8d676810d5ea0116d1b7bb6a36aea0f20901ce8
|
|
BLAKE2b-256 checksum How to use checksums |
cd5fe6e829be70e80a34a037677aa999dab22c2c2dca79ed64e7c82d316db568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|