https://github.com/gensimone/myao
A flexible Nyaa API written in Python
https://github.com/gensimone/myao
anime nyaa nyaa-api nyaa-rss nyaa-si nyaasi python python-api sukebei torrent
Last synced: 3 months ago
JSON representation
A flexible Nyaa API written in Python
- Host: GitHub
- URL: https://github.com/gensimone/myao
- Owner: gensimone
- License: mit
- Created: 2024-08-03T16:15:15.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-04T14:09:05.000Z (8 months ago)
- Last Synced: 2025-03-05T00:04:43.451Z (3 months ago)
- Topics: anime, nyaa, nyaa-api, nyaa-rss, nyaa-si, nyaasi, python, python-api, sukebei, torrent
- Language: Python
- Homepage: https://pypi.org/project/myao
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Myao
## A flexible Nyaa API written in Python.

[](https://en.wikipedia.org/wiki/MIT_License)
---
This library is intended to allow users to interact with [Nyaa](https://nyaa.si/) and [Sukebei](https://sukebei.nyaa.si/)
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 requestsfrom 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
)
```