<br/>
<p align="center">
<a href="https://github.com/Ravencentric/pynyaa">
<img src="https://raw.githubusercontent.com/Ravencentric/pynyaa/main/docs/assets/logo.png" alt="Logo" width="400">
</a>
<p align="center">
Turn nyaa.si torrent pages into neat Python objects
<br/>
<br/>
</p>
</p>
<p align="center">
<a href="https://pypi.org/project/pynyaa/"><img src="https://img.shields.io/pypi/v/pynyaa" alt="PyPI - Version" ></a>
<img src="https://img.shields.io/pypi/pyversions/pynyaa" alt="PyPI - Python Version">
<img src="https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/release.yml?" alt="GitHub Workflow Status">
<img src="https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/test.yml?label=tests" alt="GitHub Workflow Status">
<img src="https://img.shields.io/github/license/Ravencentric/pynyaa" alt="License">
<img src="https://www.mypy-lang.org/static/mypy_badge.svg" alt="Checked with mypy">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
</p>
## Table Of Contents
* [About](#about)
* [Installation](#installation)
* [Usage](#usage)
* [Docs](#docs)
* [License](#license)
## About
I needed to parse the details out of nyaa torrent pages for one of my personal projects so I initially wrote a little module to do just that but then decided it'll probably be useful as an independent library so here we are.
Some features:
- Supports both sync and async.
- Supports caching.
- Provides easy access to every field except comments (comments are useless).
- Parses both the nyaa page itself and it's accompanying `.torrent` file.
## Installation
`pynyaa` is available on [PyPI](https://pypi.org/project/pynyaa/), so you can simply use [pip](https://github.com/pypa/pip) to install it.
```sh
pip install pynyaa
```
## Usage
`pynyaa` offers two main classes:
1. `Nyaa()` - Synchronous class
```py
from pynyaa import Nyaa
nyaa = Nyaa().get("https://nyaa.si/view/1693817") # Full URL
# You can also pass any httpx.Client() keyword argument to Nyaa()
headers = {"user-agent": "my-app/0.0.1"}
client = Nyaa(headers=headers)
nyaa = client.get(1693817) # Only the ID also works
print(nyaa.title)
"""
[LYS1TH3A] Fate/stay night Heaven's Feel I. Presage Flower (2017) (BD 1080p HEVC x265 10-bit Opus) [Dual-Audio]
"""
print(nyaa.submitter)
"""
Submitter(name='pog42', url=Url('https://nyaa.si/user/pog42'), is_trusted=False, is_banned=False)
"""
print(nyaa.torrent.files)
"""
[File('Fate.stay.night.Heavens.Feel.I.Presage.Flower.2017.1080p.BluRay.Opus5.1.H.265-LYS1TH3A.mkv', size=12263052206)]
"""
print(nyaa.torrent.infohash)
"""
6fdc0395a7fdde6ce3fb7f144b31f3cabdcbf537
"""
```
2. `AsyncNyaa()` - Asynchronous class
```py
import asyncio
from pynyaa import AsyncNyaa
nyaa = asyncio.run(AsyncNyaa().get("https://nyaa.si/view/1794334")) # Full URL
# You can also pass any httpx.AsyncClient() keyword argument to AsyncNyaa()
headers = {"user-agent": "my-app/0.0.1"}
client = AsyncNyaa(headers=headers)
nyaa = asyncio.run(client.get(1794334)) # Only the ID also works
print(nyaa.title)
"""
[MTBB] The Dangers in My Heart S2 - 12 (WEB 1080p) | Boku no Kokoro no Yabai Yatsu S2
"""
print(nyaa.submitter)
"""
Submitter(name='motbob', url=Url('https://nyaa.si/user/motbob'), is_trusted=True, is_banned=False)
"""
print(nyaa.torrent.files)
"""
[File('[MTBB] The Dangers in My Heart S2 - 12 (WEB 1080p) [DE972341].mkv', size=758024360)]
"""
print(nyaa.torrent.infohash)
"""
fccba66ad15e9d3918fb965654b93679a6c59936
"""
```
# Docs
Checkout the complete API Reference [here](https://ravencentric.github.io/pynyaa/)
## License
Distributed under the [Unlicense](https://choosealicense.com/licenses/unlicense/) License. See [UNLICENSE](https://github.com/Ravencentric/pynyaa/blob/main/UNLICENSE) for more information.
Raw data
{
"_id": null,
"home_page": "https://ravencentric.github.io/pynyaa",
"name": "pynyaa",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "anime, nyaa, nyaa.si, torrent, python",
"author": "Raventric",
"author_email": "78981416+Ravencentric@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/6b/fe/7b4f334654b7cd884510da7c4c1314ec5234c86af604c2df2595251cf6ba/pynyaa-0.1.1.tar.gz",
"platform": null,
"description": "<br/>\n<p align=\"center\">\n <a href=\"https://github.com/Ravencentric/pynyaa\">\n <img src=\"https://raw.githubusercontent.com/Ravencentric/pynyaa/main/docs/assets/logo.png\" alt=\"Logo\" width=\"400\">\n </a>\n <p align=\"center\">\n Turn nyaa.si torrent pages into neat Python objects\n <br/>\n <br/>\n </p>\n</p>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/pynyaa/\"><img src=\"https://img.shields.io/pypi/v/pynyaa\" alt=\"PyPI - Version\" ></a>\n<img src=\"https://img.shields.io/pypi/pyversions/pynyaa\" alt=\"PyPI - Python Version\">\n<img src=\"https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/release.yml?\" alt=\"GitHub Workflow Status\">\n<img src=\"https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/test.yml?label=tests\" alt=\"GitHub Workflow Status\">\n<img src=\"https://img.shields.io/github/license/Ravencentric/pynyaa\" alt=\"License\">\n<img src=\"https://www.mypy-lang.org/static/mypy_badge.svg\" alt=\"Checked with mypy\">\n<img src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\">\n</p>\n\n## Table Of Contents\n\n* [About](#about)\n* [Installation](#installation)\n* [Usage](#usage)\n* [Docs](#docs)\n* [License](#license)\n\n## About\n\nI needed to parse the details out of nyaa torrent pages for one of my personal projects so I initially wrote a little module to do just that but then decided it'll probably be useful as an independent library so here we are.\n\nSome features:\n\n- Supports both sync and async.\n- Supports caching.\n- Provides easy access to every field except comments (comments are useless).\n- Parses both the nyaa page itself and it's accompanying `.torrent` file.\n\n## Installation\n\n`pynyaa` is available on [PyPI](https://pypi.org/project/pynyaa/), so you can simply use [pip](https://github.com/pypa/pip) to install it.\n\n```sh\npip install pynyaa\n```\n\n## Usage\n\n`pynyaa` offers two main classes:\n\n1. `Nyaa()` - Synchronous class\n\n ```py\n from pynyaa import Nyaa\n\n nyaa = Nyaa().get(\"https://nyaa.si/view/1693817\") # Full URL\n\n # You can also pass any httpx.Client() keyword argument to Nyaa()\n headers = {\"user-agent\": \"my-app/0.0.1\"}\n client = Nyaa(headers=headers)\n\n nyaa = client.get(1693817) # Only the ID also works\n\n print(nyaa.title)\n \"\"\"\n [LYS1TH3A] Fate/stay night Heaven's Feel I. Presage Flower (2017) (BD 1080p HEVC x265 10-bit Opus) [Dual-Audio]\n \"\"\"\n print(nyaa.submitter)\n \"\"\"\n Submitter(name='pog42', url=Url('https://nyaa.si/user/pog42'), is_trusted=False, is_banned=False)\n \"\"\"\n print(nyaa.torrent.files)\n \"\"\"\n [File('Fate.stay.night.Heavens.Feel.I.Presage.Flower.2017.1080p.BluRay.Opus5.1.H.265-LYS1TH3A.mkv', size=12263052206)]\n \"\"\"\n print(nyaa.torrent.infohash)\n \"\"\"\n 6fdc0395a7fdde6ce3fb7f144b31f3cabdcbf537\n \"\"\"\n ```\n\n2. `AsyncNyaa()` - Asynchronous class\n\n ```py\n import asyncio\n from pynyaa import AsyncNyaa\n\n nyaa = asyncio.run(AsyncNyaa().get(\"https://nyaa.si/view/1794334\")) # Full URL\n\n # You can also pass any httpx.AsyncClient() keyword argument to AsyncNyaa()\n headers = {\"user-agent\": \"my-app/0.0.1\"}\n client = AsyncNyaa(headers=headers)\n\n nyaa = asyncio.run(client.get(1794334)) # Only the ID also works\n\n print(nyaa.title)\n \"\"\"\n [MTBB] The Dangers in My Heart S2 - 12 (WEB 1080p) | Boku no Kokoro no Yabai Yatsu S2\n \"\"\"\n print(nyaa.submitter)\n \"\"\"\n Submitter(name='motbob', url=Url('https://nyaa.si/user/motbob'), is_trusted=True, is_banned=False)\n \"\"\"\n print(nyaa.torrent.files)\n \"\"\"\n [File('[MTBB] The Dangers in My Heart S2 - 12 (WEB 1080p) [DE972341].mkv', size=758024360)]\n \"\"\"\n print(nyaa.torrent.infohash)\n \"\"\"\n fccba66ad15e9d3918fb965654b93679a6c59936\n \"\"\"\n ```\n\n# Docs\n\nCheckout the complete API Reference [here](https://ravencentric.github.io/pynyaa/)\n\n## License\n\nDistributed under the [Unlicense](https://choosealicense.com/licenses/unlicense/) License. See [UNLICENSE](https://github.com/Ravencentric/pynyaa/blob/main/UNLICENSE) for more information.",
"bugtrack_url": null,
"license": "Unlicense",
"summary": "Turn nyaa.si torrent pages into neat Python objects",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://ravencentric.github.io/pynyaa",
"Homepage": "https://ravencentric.github.io/pynyaa",
"Repository": "https://github.com/Ravencentric/pynyaa"
},
"split_keywords": [
"anime",
" nyaa",
" nyaa.si",
" torrent",
" python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7b6a5db6603e5c96335a8d9af7d422dfd772183797ffe8df46bb7b69d652de64",
"md5": "c7c1b8693caf015090b01bdf3b384c72",
"sha256": "0af07208f062cfe7b8fc4f135d4dd36d3948b06148f8f5cb5803c1da60ead5fd"
},
"downloads": -1,
"filename": "pynyaa-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c7c1b8693caf015090b01bdf3b384c72",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12443,
"upload_time": "2024-03-27T03:27:25",
"upload_time_iso_8601": "2024-03-27T03:27:25.174256Z",
"url": "https://files.pythonhosted.org/packages/7b/6a/5db6603e5c96335a8d9af7d422dfd772183797ffe8df46bb7b69d652de64/pynyaa-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6bfe7b4f334654b7cd884510da7c4c1314ec5234c86af604c2df2595251cf6ba",
"md5": "080fc33e61930c18e5a389ddca744268",
"sha256": "e1cb581236b638cce25e06b201ec41ec94f2d31b4064b02c2f72b1e2f9847061"
},
"downloads": -1,
"filename": "pynyaa-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "080fc33e61930c18e5a389ddca744268",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9747,
"upload_time": "2024-03-27T03:27:26",
"upload_time_iso_8601": "2024-03-27T03:27:26.776818Z",
"url": "https://files.pythonhosted.org/packages/6b/fe/7b4f334654b7cd884510da7c4c1314ec5234c86af604c2df2595251cf6ba/pynyaa-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-27 03:27:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Ravencentric",
"github_project": "pynyaa",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pynyaa"
}