# Myao
## A flexible Nyaa API written in Python.
![Version](https://img.shields.io/badge/version-0.0.2-blue)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://en.wikipedia.org/wiki/MIT_License)
---
This library is intended to allow users to interact with Nyaa and Sukebei
without forcing the use of a specific HTTP library like requests and the
use of a specific HTML parser like lxml. Only static components are
implemented: a component for defining URLs and for extracting and organizing
the resulting data.
## Installation
```shell
pip install myao
```
## Usage
More examples in the 'examples' directory
```python
import requests
from myao.urls import get_single_torrent_url, format_url
from myao.parameters import Category, Subcategory, Filter, Order
from myao.extractors import (
get_comments,
get_multiple_torrents,
get_multiple_torrents_rss,
Parser
)
# ---------- Comments ----------------- #
code = 1273100
url = get_single_torrent_url(code)
response = requests.get(url)
response.raise_for_status()
comments = get_comments(
content=response.content,
parser=Parser.LXML
)
# ----------- Torrents ---------------- #
url = format_url(
query='Lain',
category=Category.ANIME,
subcategory=Subcategory.ENGLISH_TRANSLATED,
filter_=Filter.TRUSTED_ONLY,
order=Order.ASCENDING
)
response = requests.get(url)
response.raise_for_status()
torrents = get_multiple_torrents(
content=response.content,
parser=Parser.HTML
)
# ----------- Torrents RSS ------------ #
url = format_url(
query='Steins;Gate',
category=Category.LITERATURE,
subcategory=Subcategory.RAW,
rss=True
)
response = requests.get(url)
response.raise_for_status()
torrents = get_multiple_torrents_rss(
content=response.content,
parser=Parser.HTML5LIB
)
```
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/myao/",
"name": "myao",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.6",
"maintainer_email": null,
"keywords": "nyaa, nyaa-api, nyaa-rss, nyaasi, nyaa-si, sukebei, sukebei-api, sukebei-rss, nyaa.land, nyaa-land, nyaa.land-api, nyaa-land-api, torrent, torrent download, torrent-api, python-api",
"author": "Simone Gentili",
"author_email": "gensydev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2f/78/657e6f6c7110bbec9506bb2e5903809a333269d67f3a1f483d1e822f5477/myao-0.0.2.tar.gz",
"platform": null,
"description": "# Myao\n## A flexible Nyaa API written in Python.\n![Version](https://img.shields.io/badge/version-0.0.2-blue)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://en.wikipedia.org/wiki/MIT_License)\n---\nThis library is intended to allow users to interact with Nyaa and Sukebei \nwithout forcing the use of a specific HTTP library like requests and the \nuse of a specific HTML parser like lxml. Only static components are \nimplemented: a component for defining URLs and for extracting and organizing \nthe resulting data.\n\n## Installation\n```shell\npip install myao\n```\n\n## Usage\nMore examples in the 'examples' directory\n```python\nimport requests\n\nfrom myao.urls import get_single_torrent_url, format_url\nfrom myao.parameters import Category, Subcategory, Filter, Order\nfrom myao.extractors import (\n get_comments,\n get_multiple_torrents,\n get_multiple_torrents_rss,\n Parser\n)\n\n\n# ---------- Comments ----------------- #\n\ncode = 1273100\nurl = get_single_torrent_url(code)\n\nresponse = requests.get(url)\nresponse.raise_for_status()\n\ncomments = get_comments(\n content=response.content, \n parser=Parser.LXML\n)\n\n# ----------- Torrents ---------------- #\n\nurl = format_url(\n query='Lain',\n category=Category.ANIME,\n subcategory=Subcategory.ENGLISH_TRANSLATED,\n filter_=Filter.TRUSTED_ONLY,\n order=Order.ASCENDING\n)\n\nresponse = requests.get(url)\nresponse.raise_for_status()\n\ntorrents = get_multiple_torrents(\n content=response.content, \n parser=Parser.HTML\n)\n\n# ----------- Torrents RSS ------------ #\n\nurl = format_url(\n query='Steins;Gate',\n category=Category.LITERATURE,\n subcategory=Subcategory.RAW,\n rss=True\n)\n\nresponse = requests.get(url)\nresponse.raise_for_status()\n\ntorrents = get_multiple_torrents_rss(\n content=response.content,\n parser=Parser.HTML5LIB\n)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A flexible Nyaa API written in Python",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://pypi.org/project/myao/",
"Repository": "https://github.com/g3nsy/myao"
},
"split_keywords": [
"nyaa",
" nyaa-api",
" nyaa-rss",
" nyaasi",
" nyaa-si",
" sukebei",
" sukebei-api",
" sukebei-rss",
" nyaa.land",
" nyaa-land",
" nyaa.land-api",
" nyaa-land-api",
" torrent",
" torrent download",
" torrent-api",
" python-api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "07436cd14016c258d424cb42bb0bf03388d0411cc547bfeadeb93b08bd1c0281",
"md5": "b52bca657607063669cda08ffe284643",
"sha256": "1466b1d83e9fffaf80e9c2cd9bcc16464b1920574db8d58cd0fe03fabbd2f1a5"
},
"downloads": -1,
"filename": "myao-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b52bca657607063669cda08ffe284643",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.6",
"size": 10511,
"upload_time": "2024-08-03T23:12:19",
"upload_time_iso_8601": "2024-08-03T23:12:19.229081Z",
"url": "https://files.pythonhosted.org/packages/07/43/6cd14016c258d424cb42bb0bf03388d0411cc547bfeadeb93b08bd1c0281/myao-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2f78657e6f6c7110bbec9506bb2e5903809a333269d67f3a1f483d1e822f5477",
"md5": "aa4d2c19598df453f5c9b04267fd5ec4",
"sha256": "5919ad24cda93a5575f1bcb9fecbe2db9a59447b6c86eaa46901bc0d63bbf76b"
},
"downloads": -1,
"filename": "myao-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "aa4d2c19598df453f5c9b04267fd5ec4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.6",
"size": 9187,
"upload_time": "2024-08-03T23:12:20",
"upload_time_iso_8601": "2024-08-03T23:12:20.757859Z",
"url": "https://files.pythonhosted.org/packages/2f/78/657e6f6c7110bbec9506bb2e5903809a333269d67f3a1f483d1e822f5477/myao-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-03 23:12:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "g3nsy",
"github_project": "myao",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "myao"
}