A flexible Nyaa API written in Python
Project description
Myao
A flexible Nyaa API written in Python.
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
pip install myao
Usage
More examples in the 'examples' directory
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
)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file myao-0.0.2.tar.gz.
File metadata
- Download URL: myao-0.0.2.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.10.2-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5919ad24cda93a5575f1bcb9fecbe2db9a59447b6c86eaa46901bc0d63bbf76b
|
|
| MD5 |
aa4d2c19598df453f5c9b04267fd5ec4
|
|
| BLAKE2b-256 |
2f78657e6f6c7110bbec9506bb2e5903809a333269d67f3a1f483d1e822f5477
|
File details
Details for the file myao-0.0.2-py3-none-any.whl.
File metadata
- Download URL: myao-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.10.2-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1466b1d83e9fffaf80e9c2cd9bcc16464b1920574db8d58cd0fe03fabbd2f1a5
|
|
| MD5 |
b52bca657607063669cda08ffe284643
|
|
| BLAKE2b-256 |
07436cd14016c258d424cb42bb0bf03388d0411cc547bfeadeb93b08bd1c0281
|