An asynchronous library for scraping and searching torrents on nyaa.si and sukebei.nyaa.si.
pip install nyaascraper
git clone https://github.com/zrekryu/nyaascraper
pip install -r requirements.txt
python setup.py install
import asyncio
from nyaascraper import NyaaClient
client = NyaaClient()
async def main() -> None:
torrents = await client.search("Naruto")
print(torrents)
asyncio.run(main())
from nyaascraper.utils import Filter
await client.search("Naruto", filter_=Filter.NO_REMAKES)
from nyaascraper.utils import Category, Subcategory
await client.search("Naruto", category=Category.ANIME, subcategory=Subcategory.ANIME.RAW)
from nyaascraper.utils import SortBy, SortOrder
await client.search("Naruto", sort_by=SortBy.SEEDERS, sort_order=SortOrder.DESCENDING)
await client.search("Naruto", page=3)
To search for torrents uploaded by a specific user.
await client.search("Naruto", username="Erai-raws")
from nyaascraper.utils import SITE
from nyaascraper import NyaaClient
client = NyaaClient(SITE.FAP)
torrents = await client.search("Doraemon")
await client.get_torrent_info(torrents[0].view_id)
- Constants for different sites.
FUN
: "https://nyaa.si"FAP
: "https://sukebei.nyaa.si"
- Constants for different filters.
NO_FILTER
: 0NO_REMAKES
: 1TRUSTED_ONLY
: 2
- Constants for different torrent categories.
ALL_CATEGORIES
: 0ANIME
: 1AUDIO
: 2LITERATURE
: 3LIVE_ACTION
: 4PICTURES
: 5SOFTWARE
: 6ART
: 1REAL_LIFE
: 2
- Constants for different torrent subcategories.
- 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
- Lossless (
Subcategory.AUDIO.LOSSLESS
): 1 - Lossy (
Subcategory.AUDIO.LOSSY
): 2
- English Translation (
Subcategory.LITERATURE.ENGLISH_TRANSLATION
): 1 - Non-English Translation (
Subcategory.LITERATURE.NON_ENGLISH_TRANSLATION
): 2 - Raw (
Subcategory.LITERATURE.RAW
): 3
- 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
- Graphics (
Subcategory.PICTURES.GRAPHICS
): 1 - Photos (
Subcategory.PICTURES.PHOTOS
): 2
- Apps (
Subcategory.SOFTWARE.APPS
): 1 - Games (
Subcategory.SOFTWARE.GAMES
): 2
- 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
- Pictures (
Subcategory.REAL_LIFE.PICTURES
): 1 - Videos (
Subcategory.REAL_LIFE.VIDEOS
): 2
- Constants for different sorting options for torrents.
COMMENTS
: "comments"SIZE
: "size"DATE
: "id"SEEDERS
: "seeders"LEECHERS
: "leechers"COMPLETED
: "downloads"
- Constants for different sorting orders for torrents.
ASCENDING
: "asc"DESCENDING
: "desc"
Licensed under the Unlicense.