<div align="center">
<h1>PyRule34</h1>
**This is a lightweight asynchronous library for the <a href="https://rule34.xxx">rule34</a> API**
<p><strong>
English
·
<a href="/.github/README_RU.md">Русский</a>
</strong></p>
<!--https://img.shields.io/badge/License-GPL_3.0-<COLOR>.svg?style=for-the-badge-->
<a>[![GitHub - License](https://img.shields.io/github/license/Hypick122/pyrule34.svg?style=for-the-badge&color=light-green)](https://github.com/Hypick122/pyrule34/blob/master/LICENSE)</a>
<br>
<a>[![PyPI - Version](https://img.shields.io/pypi/v/pyrule34?color=blue&style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/pyrule34)</a>
<a>[![PyPI - Downloads](https://img.shields.io/pypi/dm/pyrule34?style=for-the-badge&color=blue)](https://pepy.tech/project/pyrule34)</a>
<br>
<a>[![Python - Version](https://img.shields.io/badge/PYTHON-3.5+-red?style=for-the-badge&logo=python&logoColor=white)](https://pepy.tech/project/pyrule34)</a>
<!--[![PyPI status](https://img.shields.io/pypi/status/pyrule34.svg?style=for-the-badge)](https://pypi.python.org/pypi/pyrule34)-->
<!--https://img.shields.io/pypi/pyversions/pyrule34.svg?style=for-the-badge-->
</div>
## Table of Contents
- [Getting Started](#getting-started)
- [Install using PyPI](#install-using-pypi)
- [Clone the repository](#clone-the-repository)
- [Usage](#usage)
- [Search](#search)
- [Get post](#get-post)
- [Comments on the post](#comments-on-the-post)
- [Random post](#random-post)
- [Pool](#pool)
- [User Favorites](#user-favorites)
- [Top 100 characters and tags](#top-100-characters-and-tags)
- [Top users](#top-users)
## Getting Started
##### Install using PyPI
```
pip install -U pyrule34
```
or
##### Clone the repository
```
git clone https://github.com/Hypick122/pyrule34.git
```
2. Install the required Python packages:
```
pip install -U aiohttp, beautifulsoup4, lxml
```
3. Create a .py file and import the required libraries:
```python
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)
```python
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)
```python
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
```python
get_post_comments = await r34.get_post_comments(4153825)
```
### Random post
Get a random post.
Returns a dict.
```python
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
```python
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
```python
favorite = await r34.users.favorites(2993217)
```
### Top 100 characters and tags
Get the top 100 characters or tags.
Returns a list.
```python
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.
```python
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()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Hypick122/pyrule34",
"name": "pyrule34test",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "async rule34,rule34 api,async,asyncio,wrapper,api",
"author": "Hypick122",
"author_email": "",
"download_url": "",
"platform": null,
"description": "<div align=\"center\">\n <h1>PyRule34</h1>\n \n **This is a lightweight asynchronous library for the <a href=\"https://rule34.xxx\">rule34</a> API**\n \n <p><strong>\n English\n \u00b7\n <a href=\"/.github/README_RU.md\">\u0420\u0443\u0441\u0441\u043a\u0438\u0439</a>\n </strong></p>\n \n <!--https://img.shields.io/badge/License-GPL_3.0-<COLOR>.svg?style=for-the-badge-->\n <a>[![GitHub - License](https://img.shields.io/github/license/Hypick122/pyrule34.svg?style=for-the-badge&color=light-green)](https://github.com/Hypick122/pyrule34/blob/master/LICENSE)</a>\n <br>\n <a>[![PyPI - Version](https://img.shields.io/pypi/v/pyrule34?color=blue&style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/pyrule34)</a>\n <a>[![PyPI - Downloads](https://img.shields.io/pypi/dm/pyrule34?style=for-the-badge&color=blue)](https://pepy.tech/project/pyrule34)</a>\n <br>\n <a>[![Python - Version](https://img.shields.io/badge/PYTHON-3.5+-red?style=for-the-badge&logo=python&logoColor=white)](https://pepy.tech/project/pyrule34)</a>\n <!--[![PyPI status](https://img.shields.io/pypi/status/pyrule34.svg?style=for-the-badge)](https://pypi.python.org/pypi/pyrule34)-->\n <!--https://img.shields.io/pypi/pyversions/pyrule34.svg?style=for-the-badge-->\n</div>\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n - [Install using PyPI](#install-using-pypi)\n - [Clone the repository](#clone-the-repository)\n- [Usage](#usage)\n - [Search](#search)\n - [Get post](#get-post)\n - [Comments on the post](#comments-on-the-post)\n - [Random post](#random-post)\n - [Pool](#pool)\n - [User Favorites](#user-favorites)\n - [Top 100 characters and tags](#top-100-characters-and-tags)\n - [Top users](#top-users)\n\n## Getting Started\n\n##### Install using PyPI\n\n```\npip install -U pyrule34\n```\n\nor\n\n##### Clone the repository\n\n```\ngit clone https://github.com/Hypick122/pyrule34.git\n```\n\n2. Install the required Python packages:\n\n```\npip install -U aiohttp, beautifulsoup4, lxml\n```\n\n3. Create a .py file and import the required libraries:\n\n```python\nimport asyncio\nfrom pyrule34 import AsyncRule34\n```\n\n## Usage\n\n```\nAsyncRule34 can be used as a context manager:\n```python\n#example\nasync def main():\n async with AsyncRule34() as r34:\n get_posts = await r34.get_posts(4931536)\n \n print(get_posts[0].tags)\n \nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n```\n\n### Search\n\nSearch for posts using specified inclusion and exclusion tags.\n\nReturns a list.\n\nParameters:\n- `tags` - The include tags\n- `exclude_tags` - The exclude tags (default: None)\n- `limit` - The (maximum) limit to get posts. Maximum 1000 per one request (default: 100)\n- `page_id` - The page number (default: 0)\n```python\nsearch = await r34.search(tags=[\"neko\"], exclude_tags=[\"rating:general\"], page_id=2, limit=1)\n```\n\n### Get post\n\nRetrieve post(s) by ID or MD5 hash.\n\nReturns a list.\n\nParameters:\n- `posts_id`: The list of IDs posts or post ID\n- `md5`: The MD5 hash of the post (default: None)\n```python\nget_posts = await r34.get_posts(4931536)\n```\n\n### Comments on the post\n\nGet comments by post ID.\n\nReturns a list.\n\nParameters:\n- `post_id`: The ID of the post\n```python\nget_post_comments = await r34.get_post_comments(4153825)\n```\n\n### Random post\n\nGet a random post.\n\nReturns a dict.\n```python\nget_random_post = await r34.get_random_post()\n```\n\n### Pool\n\nGet Pool by ID.\n\nReturns a list.\n\nParameters:\n- `cid`: Pool ID\n- `offset`: offset (default: 0) | 1 page - 45\n```python\nget_pool = await r34.get_pool(29619)\n```\n\n### User favorites\n\nGet user's favorites by ID.\n\nReturns a list.\n\nParameters:\n- `user_id`: user ID\n- `offset`: offset (default: 0) | 1 page - 50\n```python\nfavorite = await r34.users.favorites(2993217)\n```\n\n### Top 100 characters and tags\n\nGet the top 100 characters or tags.\n\nReturns a list.\n```python\ntop_character = await r34.top_characters()\ntop_tags = await r34.top_tags()\n```\n\n### Top users\n\nGet the top 10 best users by tags, comments, etc.\n\nReturns a list.\n```python\ntaggers = await r34.stats.taggers()\nfavorites = await r34.stats.favorites()\ncommenters = await r34.stats.commenters()\nforum_posters = await r34.stats.forum_posters()\nimage_posters = await r34.stats.image_posters()\nnote_editors = await r34.stats.note_editors()\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Asynchronous wrapper for rule34.xxx.",
"version": "2.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/Hypick122/pyrule34/issues",
"Documentation": "https://github.com/Hypick122/pyrule34/README.md",
"Homepage": "https://github.com/Hypick122/pyrule34",
"Repository": "https://github.com/Hypick122/pyrule34"
},
"split_keywords": [
"async rule34",
"rule34 api",
"async",
"asyncio",
"wrapper",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "971ea2c505e7467354b8f3fbf5ffe233b0d05a2901306070dada362b7efce73e",
"md5": "0d93af8be6e5488d779d943dedf247e7",
"sha256": "33cc491ed8202d6530c2dbc44c2ce8493b1e936d243af65a49799732ee67109d"
},
"downloads": -1,
"filename": "pyrule34test-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d93af8be6e5488d779d943dedf247e7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 6832,
"upload_time": "2024-03-18T15:25:29",
"upload_time_iso_8601": "2024-03-18T15:25:29.743472Z",
"url": "https://files.pythonhosted.org/packages/97/1e/a2c505e7467354b8f3fbf5ffe233b0d05a2901306070dada362b7efce73e/pyrule34test-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-18 15:25:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hypick122",
"github_project": "pyrule34",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyrule34test"
}