# NyaaScraper
An asynchronous library for scraping and searching torrents on [nyaa.si](https://nyaa.si) and [sukebei.nyaa.si](https://sukebei.nyaa.si).
## INSTALLATION
### Using pip:
```bash
pip install nyaascraper
```
### Local Setup:
```bash
git clone https://github.com/zrekryu/nyaascraper
pip install -r requirements.txt
python setup.py install
```
## USAGE
### Search Torrents:
```py
import asyncio
from nyaascraper import NyaaClient
client = NyaaClient()
async def main() -> None:
torrents = await client.search("Naruto")
print(torrents)
asyncio.run(main())
```
### Search with Filter:
```py
from nyaascraper.utils import Filter
await client.search("Naruto", filter_=Filter.NO_REMAKES)
```
### Search with Category and Sub-category:
```py
from nyaascraper.utils import Category, Subcategory
await client.search("Naruto", category=Category.ANIME, subcategory=Subcategory.ANIME.RAW)
```
### Sorting Torrents:
```py
from nyaascraper.utils import SortBy, SortOrder
await client.search("Naruto", sort_by=SortBy.SEEDERS, sort_order=SortOrder.DESCENDING)
```
### Search Torrents on Specific Page:
```py
await client.search("Naruto", page=3)
```
### Search torrents by Username:
To search for torrents uploaded by a specific user.
```py
await client.search("Naruto", username="Erai-raws")
```
### Using sukebei.nyaa.si:
```py
from nyaascraper.utils import SITE
from nyaascraper import NyaaClient
client = NyaaClient(SITE.FAP)
```
### Getting torrent information:
```py
torrents = await client.search("Doraemon")
await client.get_torrent_info(torrents[0].view_id)
```
## UTILS
### SITE
- Constants for different sites.
#### Constants
- `FUN`: "https://nyaa.si"
- `FAP`: "https://sukebei.nyaa.si"
### Filter
- Constants for different filters.
#### Constants
- `NO_FILTER`: 0
- `NO_REMAKES`: 1
- `TRUSTED_ONLY`: 2
### Category
- Constants for different torrent categories.
#### Constants
- `ALL_CATEGORIES`: 0
- `ANIME`: 1
- `AUDIO`: 2
- `LITERATURE`: 3
- `LIVE_ACTION`: 4
- `PICTURES`: 5
- `SOFTWARE`: 6
- `ART`: 1
- `REAL_LIFE`: 2
### Subcategory
- Constants for different torrent subcategories.
#### Anime Subcategories (`Subcategory.ANIME`)
- **Anime Music Video (`Subcategory.ANIME.ANIME_MUSIC_VIDEO`):** 1
- **English Translation (`Subcategory.ANIME.ENGLISH_TRANSLATION`):** 2
- **Non-English Translation (`Subcategory.ANIME.NON_ENGLISH_TRANSLATION`):** 3
- **Raw (`Subcategory.ANIME.RAW`):** 4
#### Audio Subcategories (`Subcategory.AUDIO`)
- **Lossless (`Subcategory.AUDIO.LOSSLESS`):** 1
- **Lossy (`Subcategory.AUDIO.LOSSY`):** 2
#### Literature Subcategories (`Subcategory.LITERATURE`)
- **English Translation (`Subcategory.LITERATURE.ENGLISH_TRANSLATION`):** 1
- **Non-English Translation (`Subcategory.LITERATURE.NON_ENGLISH_TRANSLATION`):** 2
- **Raw (`Subcategory.LITERATURE.RAW`):** 3
#### Live Action Subcategories (`Subcategory.LIVE_ACTION`)
- **English Translation (`Subcategory.LIVE_ACTION.ENGLISH_TRANSLATION`):** 1
- **Idol Promotional Video (`Subcategory.LIVE_ACTION.IDOL_PROMOTIONAL_VIDEO`):** 2
- **Non-English Translation (`Subcategory.LIVE_ACTION.NON_ENGLISH_TRANSLATION`):** 3
- **Raw (`Subcategory.LIVE_ACTION.RAW`):** 4
#### Pictures Subcategories (`Subcategory.PICTURES`)
- **Graphics (`Subcategory.PICTURES.GRAPHICS`):** 1
- **Photos (`Subcategory.PICTURES.PHOTOS`):** 2
#### Software Subcategories (`Subcategory.SOFTWARE`)
- **Apps (`Subcategory.SOFTWARE.APPS`):** 1
- **Games (`Subcategory.SOFTWARE.GAMES`):** 2
#### Art Subcategories (`Subcategory.ART`)
- **Anime (`Subcategory.ART.ANIME`):** 1
- **Doujinshi (`Subcategory.ART.DOUJINSHI`):** 2
- **Games (`Subcategory.ART.GAMES`):** 3
- **Manga (`Subcategory.ART.MANGA`):** 4
- **Pictures (`Subcategory.ART.PICTURES`):** 5
#### Real Life Subcategories (`Subcategory.REAL_LIFE`)
- **Pictures (`Subcategory.REAL_LIFE.PICTURES`):** 1
- **Videos (`Subcategory.REAL_LIFE.VIDEOS`):** 2
### SortBy
- Constants for different sorting options for torrents.
#### Constants
- `COMMENTS`: "comments"
- `SIZE`: "size"
- `DATE`: "id"
- `SEEDERS`: "seeders"
- `LEECHERS`: "leechers"
- `COMPLETED`: "downloads"
### SortOrder
- Constants for different sorting orders for torrents.
#### Constants
- `ASCENDING`: "asc"
- `DESCENDING`: "desc"
## LICENSE
Licensed under the [Unlicense](https://unlicense.org/).
Raw data
{
"_id": null,
"home_page": "https://github.com/zrekryu/nyaascraper",
"name": "nyaascraper",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "nyaa,sukebei,torrent,asynchronous,web scraping,beautifulsoup4,bs4,httpx",
"author": "Zrekryu",
"author_email": "zrekryu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/80/37/9d8d893940144c753a4dbd901aaaceec1d45c75341b6b250581979313263/nyaascraper-1.0.3.tar.gz",
"platform": null,
"description": "# NyaaScraper\nAn asynchronous library for scraping and searching torrents on [nyaa.si](https://nyaa.si) and [sukebei.nyaa.si](https://sukebei.nyaa.si).\n\n## INSTALLATION\n\n### Using pip:\n```bash\npip install nyaascraper\n```\n\n### Local Setup:\n```bash\ngit clone https://github.com/zrekryu/nyaascraper\npip install -r requirements.txt\npython setup.py install\n```\n\n## USAGE\n\n### Search Torrents:\n```py\nimport asyncio\n\nfrom nyaascraper import NyaaClient\n\nclient = NyaaClient()\n\nasync def main() -> None:\n torrents = await client.search(\"Naruto\")\n print(torrents)\n\nasyncio.run(main())\n```\n\n### Search with Filter:\n```py\nfrom nyaascraper.utils import Filter\n\nawait client.search(\"Naruto\", filter_=Filter.NO_REMAKES)\n```\n\n### Search with Category and Sub-category:\n```py\nfrom nyaascraper.utils import Category, Subcategory\n\nawait client.search(\"Naruto\", category=Category.ANIME, subcategory=Subcategory.ANIME.RAW)\n```\n\n### Sorting Torrents:\n```py\nfrom nyaascraper.utils import SortBy, SortOrder\n\nawait client.search(\"Naruto\", sort_by=SortBy.SEEDERS, sort_order=SortOrder.DESCENDING)\n```\n\n### Search Torrents on Specific Page:\n```py\nawait client.search(\"Naruto\", page=3)\n```\n\n### Search torrents by Username:\nTo search for torrents uploaded by a specific user.\n```py\nawait client.search(\"Naruto\", username=\"Erai-raws\")\n```\n\n### Using sukebei.nyaa.si:\n```py\nfrom nyaascraper.utils import SITE\nfrom nyaascraper import NyaaClient\n\nclient = NyaaClient(SITE.FAP)\n```\n\n### Getting torrent information:\n```py\ntorrents = await client.search(\"Doraemon\")\nawait client.get_torrent_info(torrents[0].view_id)\n```\n\n## UTILS\n\n### SITE\n- Constants for different sites.\n\n#### Constants\n- `FUN`: \"https://nyaa.si\"\n- `FAP`: \"https://sukebei.nyaa.si\"\n\n### Filter\n- Constants for different filters.\n\n#### Constants\n- `NO_FILTER`: 0\n- `NO_REMAKES`: 1\n- `TRUSTED_ONLY`: 2\n\n### Category\n- Constants for different torrent categories.\n\n#### Constants\n- `ALL_CATEGORIES`: 0\n- `ANIME`: 1\n- `AUDIO`: 2\n- `LITERATURE`: 3\n- `LIVE_ACTION`: 4\n- `PICTURES`: 5\n- `SOFTWARE`: 6\n- `ART`: 1\n- `REAL_LIFE`: 2\n\n### Subcategory\n- Constants for different torrent subcategories.\n\n#### Anime Subcategories (`Subcategory.ANIME`)\n- **Anime Music Video (`Subcategory.ANIME.ANIME_MUSIC_VIDEO`):** 1\n- **English Translation (`Subcategory.ANIME.ENGLISH_TRANSLATION`):** 2\n- **Non-English Translation (`Subcategory.ANIME.NON_ENGLISH_TRANSLATION`):** 3\n- **Raw (`Subcategory.ANIME.RAW`):** 4\n\n#### Audio Subcategories (`Subcategory.AUDIO`)\n- **Lossless (`Subcategory.AUDIO.LOSSLESS`):** 1\n- **Lossy (`Subcategory.AUDIO.LOSSY`):** 2\n\n#### Literature Subcategories (`Subcategory.LITERATURE`)\n- **English Translation (`Subcategory.LITERATURE.ENGLISH_TRANSLATION`):** 1\n- **Non-English Translation (`Subcategory.LITERATURE.NON_ENGLISH_TRANSLATION`):** 2\n- **Raw (`Subcategory.LITERATURE.RAW`):** 3\n\n#### Live Action Subcategories (`Subcategory.LIVE_ACTION`)\n- **English Translation (`Subcategory.LIVE_ACTION.ENGLISH_TRANSLATION`):** 1\n- **Idol Promotional Video (`Subcategory.LIVE_ACTION.IDOL_PROMOTIONAL_VIDEO`):** 2\n- **Non-English Translation (`Subcategory.LIVE_ACTION.NON_ENGLISH_TRANSLATION`):** 3\n- **Raw (`Subcategory.LIVE_ACTION.RAW`):** 4\n\n#### Pictures Subcategories (`Subcategory.PICTURES`)\n- **Graphics (`Subcategory.PICTURES.GRAPHICS`):** 1\n- **Photos (`Subcategory.PICTURES.PHOTOS`):** 2\n\n#### Software Subcategories (`Subcategory.SOFTWARE`)\n- **Apps (`Subcategory.SOFTWARE.APPS`):** 1\n- **Games (`Subcategory.SOFTWARE.GAMES`):** 2\n\n#### Art Subcategories (`Subcategory.ART`)\n- **Anime (`Subcategory.ART.ANIME`):** 1\n- **Doujinshi (`Subcategory.ART.DOUJINSHI`):** 2\n- **Games (`Subcategory.ART.GAMES`):** 3\n- **Manga (`Subcategory.ART.MANGA`):** 4\n- **Pictures (`Subcategory.ART.PICTURES`):** 5\n\n#### Real Life Subcategories (`Subcategory.REAL_LIFE`)\n- **Pictures (`Subcategory.REAL_LIFE.PICTURES`):** 1\n- **Videos (`Subcategory.REAL_LIFE.VIDEOS`):** 2\n\n### SortBy\n- Constants for different sorting options for torrents.\n\n#### Constants\n- `COMMENTS`: \"comments\"\n- `SIZE`: \"size\"\n- `DATE`: \"id\"\n- `SEEDERS`: \"seeders\"\n- `LEECHERS`: \"leechers\"\n- `COMPLETED`: \"downloads\"\n\n### SortOrder\n- Constants for different sorting orders for torrents.\n\n#### Constants\n- `ASCENDING`: \"asc\"\n- `DESCENDING`: \"desc\"\n\n## LICENSE\nLicensed under the [Unlicense](https://unlicense.org/).\n",
"bugtrack_url": null,
"license": "",
"summary": "A Python-based asynchronous library for scraping and searching torrents on nyaa.si and sukebei.nyaa.si.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/zrekryu/nyaascraper"
},
"split_keywords": [
"nyaa",
"sukebei",
"torrent",
"asynchronous",
"web scraping",
"beautifulsoup4",
"bs4",
"httpx"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "25a237b15f1462c6356cd3a9c87a3beeef3cdfb7392771dc9dad7e88271675fd",
"md5": "35ed912312a3cacc3dd4956241aff26b",
"sha256": "3bc058d4f9aef3797c526ae0f90e28dafe3fad712f703f6e87672f1a28d685de"
},
"downloads": -1,
"filename": "nyaascraper-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "35ed912312a3cacc3dd4956241aff26b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2702,
"upload_time": "2023-12-01T11:53:36",
"upload_time_iso_8601": "2023-12-01T11:53:36.544562Z",
"url": "https://files.pythonhosted.org/packages/25/a2/37b15f1462c6356cd3a9c87a3beeef3cdfb7392771dc9dad7e88271675fd/nyaascraper-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "80379d8d893940144c753a4dbd901aaaceec1d45c75341b6b250581979313263",
"md5": "bc92b6cbe3c47e61173cbdacaa632250",
"sha256": "de3f0dcd69dd730280af9235e62f61fc4e5e444d942351339addb4480e2081c2"
},
"downloads": -1,
"filename": "nyaascraper-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "bc92b6cbe3c47e61173cbdacaa632250",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2926,
"upload_time": "2023-12-01T11:53:38",
"upload_time_iso_8601": "2023-12-01T11:53:38.229616Z",
"url": "https://files.pythonhosted.org/packages/80/37/9d8d893940144c753a4dbd901aaaceec1d45c75341b6b250581979313263/nyaascraper-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-01 11:53:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zrekryu",
"github_project": "nyaascraper",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "nyaascraper"
}