A Python-based asynchronous library for scraping and searching torrents on nyaa.si and sukebei.nyaa.si.
Project description
NyaaScraper
An asynchronous library for scraping and searching torrents on nyaa.si and sukebei.nyaa.si.
INSTALLATION
Using pip:
pip install nyaascraper
Local Setup:
git clone https://github.com/zrekryu/nyaascraper
pip install -r requirements.txt
python setup.py install
USAGE
Search Torrents:
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:
from nyaascraper.utils import Filter
await client.search("Naruto", filter_=Filter.NO_REMAKES)
Search with Category and Sub-category:
from nyaascraper.utils import Category, Subcategory
await client.search("Naruto", category=Category.ANIME, subcategory=Subcategory.ANIME.RAW)
Sorting Torrents:
from nyaascraper.utils import SortBy, SortOrder
await client.search("Naruto", sort_by=SortBy.SEEDERS, sort_order=SortOrder.DESCENDING)
Search Torrents on Specific Page:
await client.search("Naruto", page=3)
Search torrents by Username:
To search for torrents uploaded by a specific user.
await client.search("Naruto", username="Erai-raws")
Using sukebei.nyaa.si:
from nyaascraper.utils import SITE
from nyaascraper import NyaaClient
client = NyaaClient(SITE.FAP)
Getting torrent information:
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
: 0NO_REMAKES
: 1TRUSTED_ONLY
: 2
Category
- Constants for different torrent categories.
Constants
ALL_CATEGORIES
: 0ANIME
: 1AUDIO
: 2LITERATURE
: 3LIVE_ACTION
: 4PICTURES
: 5SOFTWARE
: 6ART
: 1REAL_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.
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
nyaascraper-1.0.3.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for nyaascraper-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bc058d4f9aef3797c526ae0f90e28dafe3fad712f703f6e87672f1a28d685de |
|
MD5 | 35ed912312a3cacc3dd4956241aff26b |
|
BLAKE2b-256 | 25a237b15f1462c6356cd3a9c87a3beeef3cdfb7392771dc9dad7e88271675fd |