Library for retrieving posts and tags from rule34.paheal.net
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Rule34 Posts Wrapper-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55f1fb92a05be93c9e3591a0bf8929cd6387cea52143440ca15f726a0bbcc6ba |
|
MD5 | 1bd5d1e0bc53c1c6877641117e5c4ce9 |
|
BLAKE2b-256 | d809c51e09765553f236acab1eab4b11efcf8566da03191884630d03b3dda2b0 |
Hashes for Rule34_Posts_Wrapper-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b7bf1de2efc39c5d358692c87086700a1bf540926688fd676afb1e972248f13 |
|
MD5 | 9cfa750d8390cc57569e417c9fcbe820 |
|
BLAKE2b-256 | ee1fa88baac79609287538d7a898f44489dcff3e0728bd1d5fcc9217f38f6c06 |