Skip to main content

Myao

A flexible Nyaa API written in Python.

Version 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

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
)

Metadata

Release files for myao 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for myao 0.0.2
File Size Uploaded
myao-0.0.2.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for myao 0.0.2
File Interpreter ABI Platform
myao-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / myao-0.0.2.tar.gz

Download URL myao-0.0.2.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5919ad24cda93a5575f1bcb9fecbe2db9a59447b6c86eaa46901bc0d63bbf76b
BLAKE2b-256 checksum
How to use checksums
2f78657e6f6c7110bbec9506bb2e5903809a333269d67f3a1f483d1e822f5477
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.10.2-arch1-1

Release files / myao-0.0.2-py3-none-any.whl

Download URL myao-0.0.2-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1466b1d83e9fffaf80e9c2cd9bcc16464b1920574db8d58cd0fe03fabbd2f1a5
BLAKE2b-256 checksum
How to use checksums
07436cd14016c258d424cb42bb0bf03388d0411cc547bfeadeb93b08bd1c0281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.10.2-arch1-1

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page