Skip to main content

Python client for nyaa.si and sukebei.nyaa.si.

Project description

pynyaasi

PyPI PyPI - Python Version Loc Comments

Code Test Package Release codecov

GitHub Org's stars GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

Python client for nyaa.si and sukebei.nyaa.si

Installation

You can simply install it with pip command line from the official PyPI site.

pip install pynyaasi

For more information about installation, you can refer to Installation.

Quick Start

nyaa.si

from pynyaasi.client import SortBy
from pynyaasi.nyaasi import NyaaSiClient, CategoryType

# create nyaa.si client
client = NyaaSiClient()

# search resource on nyaa.si
# NOTE: page is not necessary here, because `iter_items`
#       will grab the next page once the items on current page are all iterated 
#       until all the search result item run out
for item in client.iter_items('fire force'):
    print(item)

# The output should be:
# ListItem(id=1726561, category=<CategoryType.LITERATURE_ENGLISH: '3_1'>, comments=2, title='Enen no Shouboutai / Fire Force (2016-2023) (Digital) (danke-Empire)', url='https://nyaa.si/view/1726561', torrent_download_url='https://nyaa.si/download/1726561.torrent', magnet_url='magnet:?xt=urn:btih:3b60c0ca90427a845b1f3881a74cbda6cb120a46&dn=Enen%20no%20Shouboutai%20%2F%20Fire%20Force%20%282016-2023%29%20%28Digital%29%20%28danke-Empire%29&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce', size_raw='5.9 GiB', timestamp=1696796810, seeders=33, leechers=3, downloads=505, is_trusted=False, is_remake=False, is_batch=False)
# ListItem(id=1724856, category=<CategoryType.LITERATURE_ENGLISH: '3_1'>, comments=1, title='[0v3r] Fire Force v34 (2023) (Digital) (0v3r)', url='https://nyaa.si/view/1724856', torrent_download_url='https://nyaa.si/download/1724856.torrent', magnet_url='magnet:?xt=urn:btih:0e16fc5a42da95284846cca46fb57d4260d1432b&dn=%5B0v3r%5D%20Fire%20Force%20v34%20%282023%29%20%28Digital%29%20%280v3r%29&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce', size_raw='285.4 MiB', timestamp=1696514955, seeders=8, leechers=0, downloads=494, is_trusted=False, is_remake=False, is_batch=False)
# ListItem(id=1706354, category=<CategoryType.ANIME_NON_ENGLISH: '1_3'>, comments=0, title='[Pourquoi] Fire Force Henshū (Fan-Kaï) - Saison 01 - 1080p.MULTI.VFVOSTFR.x264', url='https://nyaa.si/view/1706354', torrent_download_url='https://nyaa.si/download/1706354.torrent', magnet_url='magnet:?xt=urn:btih:1a2f365364a6546988191f20d1bacad4621c34e9&dn=%5BPourquoi%5D%20Fire%20Force%20Hensh%C5%AB%20%28Fan-Ka%C3%AF%29%20-%20Saison%2001%20-%201080p.MULTI.VFVOSTFR.x264&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce', size_raw='12.0 GiB', timestamp=1692523341, seeders=10, leechers=1, downloads=114, is_trusted=False, is_remake=False, is_batch=False)
# ...

# search `fire force`, raw anime (without subtitle) only, order by comments
for item in client.iter_items('fire force', category=CategoryType.ANIME_RAW, sort_by=SortBy.COMMENTS):
    print(item)

# get resource on nyaa.si with id
resource = client.get_resource(1639366)

# see basic information
print(resource.id)  # 1639366
print(resource.title)  # [AI-Raws] 炎炎ノ消防隊 / Fire Force S1 BDRip 1080p MKV
print(resource.time)  # 2023-02-19T03:48:04+00:00
print(resource.is_trusted)  # False
print(resource.is_remake)  # False
print(resource.magnet_url)  # magnet:?xt=urn:btih:6869cfa3a7c03e41d7004205deca7e6bf62630c6&dn=%5BAI-Raws%5D%20%E7%82%8E%E7%82%8E%E3%83%8E%E6%B6%88%E9%98%B2%E9%9A%8A%20%2F%20Fire%20Force%20S1%20BDRip%201080p%20MKV&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce
print(resource.torrent_download_url)  # https://nyaa.si/download/1639366.torrent
print(resource.seeders)  # 1 (may be different when you run yourself)
print(resource.leechers)  # 1 (may be different when you run yourself)
print(resource.downloads)  # 226 (may be different when you run yourself)
print(resource.submitter)  # Anonymous

# directory tree is also here
print(resource.directory_tree)
# [AI-Raws][Fire Force] [folder, 20.6 GiB]
# ├── [AI-Raws] 炎炎の消防隊 #01 (BD HEVC 1920x1080 yuv444p10le FLAC)[00359E87].mkv [file, 1.1 GiB]
# ├── [AI-Raws] 炎炎の消防隊 #02 (BD HEVC 1920x1080 yuv444p10le FLAC)[DAC5E163].mkv [file, 807.8 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #03 (BD HEVC 1920x1080 yuv444p10le FLAC)[ED84DE60].mkv [file, 1.1 GiB]
# ├── [AI-Raws] 炎炎の消防隊 #04 (BD HEVC 1920x1080 yuv444p10le FLAC)[4D006A6F].mkv [file, 935.0 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #05 (BD HEVC 1920x1080 yuv444p10le FLAC)[25ACB9BA].mkv [file, 789.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #06 (BD HEVC 1920x1080 yuv444p10le FLAC)[ABE87DE7].mkv [file, 1.1 GiB]
# ├── [AI-Raws] 炎炎の消防隊 #07 (BD HEVC 1920x1080 yuv444p10le FLAC)[BD4F5594].mkv [file, 956.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #08 (BD HEVC 1920x1080 yuv444p10le FLAC)[62C1CD6B].mkv [file, 828.8 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #09 (BD HEVC 1920x1080 yuv444p10le FLAC)[917EA0CE].mkv [file, 922.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #10 (BD HEVC 1920x1080 yuv444p10le FLAC)[B310DA52].mkv [file, 656.0 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #11 (BD HEVC 1920x1080 yuv444p10le FLAC)[7DB51188].mkv [file, 671.2 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #12 (BD HEVC 1920x1080 yuv444p10le FLAC)[5B313F70].mkv [file, 718.8 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #13 (BD HEVC 1920x1080 yuv444p10le FLAC)[B0A57086].mkv [file, 737.4 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #14 (BD HEVC 1920x1080 yuv444p10le FLAC)[205D3328].mkv [file, 1017.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #15 (BD HEVC 1920x1080 yuv444p10le FLAC)[F938397F].mkv [file, 874.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #16 (BD HEVC 1920x1080 yuv444p10le FLAC)[635E0F84].mkv [file, 845.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #17 (BD HEVC 1920x1080 yuv444p10le FLAC)[62A10712].mkv [file, 828.2 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #18 (BD HEVC 1920x1080 yuv444p10le FLAC)[9EE1364F].mkv [file, 832.4 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #19 (BD HEVC 1920x1080 yuv444p10le FLAC)[30EB7A35].mkv [file, 852.6 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #20 (BD HEVC 1920x1080 yuv444p10le FLAC)[075B7425].mkv [file, 838.2 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #21 (BD HEVC 1920x1080 yuv444p10le FLAC)[A92DBA56].mkv [file, 748.0 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #22 (BD HEVC 1920x1080 yuv444p10le FLAC)[43A840DC].mkv [file, 820.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #23 (BD HEVC 1920x1080 yuv444p10le FLAC)[4185E25F].mkv [file, 829.0 MiB]
# ├── [AI-Raws] 炎炎の消防隊 #24 (BD HEVC 1920x1080 yuv444p10le FLAC)[2B28C1FE].mkv [file, 851.3 MiB]
# ├── [AI-Raws] 炎炎の消防隊 ノンクレジットED (BD HEVC 1920x1080 yuv444p10le FLAC)[797400C4].mkv [file, 102.5 MiB]
# ├── [AI-Raws] 炎炎の消防隊 ノンクレジットED2 (BD HEVC 1920x1080 yuv444p10le FLAC)[40B0883F].mkv [file, 58.6 MiB]
# ├── [AI-Raws] 炎炎の消防隊 ノンクレジットOP (BD HEVC 1920x1080 yuv444p10le FLAC)[1B2232B5].mkv [file, 113.4 MiB]
# └── [AI-Raws] 炎炎の消防隊 ノンクレジットOP2 (BD HEVC 1920x1080 yuv444p10le FLAC)[B452057F].mkv [file, 78.5 MiB]

For more usage, refer to documentation of NyaaSiClient.

sukebei.nyaa.si

Similar with nyaa.si, you simply need to use a SukebeiClient, and oth

from pynyaasi.client import SortBy
from pynyaasi.sukebei import SukebeiClient, CategoryType

# create sukebei.nyaa.si client
client = SukebeiClient()

# search resource on sukebei.nyaa.si
for item in client.iter_items('euphoria'):
    print(item)

# search `euphoria`, art anime (no human porn) only, order by comments
client.iter_items('euphoria', category=CategoryType.ART_ANIME, sort_by=SortBy.COMMENTS)

# get resource on sukebei.nyaa.si with id
resource = client.get_resource(3973877)

For more usage, refer to documentation of SukebeiClient.

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

pynyaasi-0.0.1.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

pynyaasi-0.0.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file pynyaasi-0.0.1.tar.gz.

File metadata

  • Download URL: pynyaasi-0.0.1.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pynyaasi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d880e815530df423362056b18aefd0e566bdd6c1f117c9d890c3bfe2f258ef1f
MD5 f467bef0cf7ec515022a2ab74705e63c
BLAKE2b-256 eb8761ca56f28e3040bb668ab080ab31ac3ee451211069edd81c69b6180bfaba

See more details on using hashes here.

File details

Details for the file pynyaasi-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pynyaasi-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pynyaasi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9879647a7891ba95ffaa5397ce185344da433a433da18f2f72da2238278bb16b
MD5 adccbc3fc424c8514feac6f8ba47c70e
BLAKE2b-256 7d4364652e00537d163701fc05057b2b2fd77223f59d130d344e6d5417cbe00f

See more details on using hashes here.

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