Skip to main content

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

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.

Project details


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)

Uploaded Source

Built Distribution

nyaascraper-1.0.3-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page