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.1.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for nyaascraper-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fad20e42aaa1fe48925790bda9a15c50e41ef439bae2559cc1880828c80a8bb0 |
|
MD5 | f8380aef167aa1f8dec494e4bdcd4a07 |
|
BLAKE2b-256 | 2083ffa226cb0e597f20d950afe0955bf94bd195076d164a6e9641fc64a25647 |