Skip to content

Models

Submitter

Bases: ParentModel

Model representing the user who submitted the torrent.

Features
  • Immutable
  • Hashable
  • Inherits from pydantic.BaseModel, so you get all of pydantic's fancy methods
  • Supports equality checking (based on the URL)

Examples:

>>> a = Submitter(name="John", url="https://nyaa.si/user/john", is_trusted=True, is_banned=False)
>>> b = Submitter(name="John", url="https://nyaa.si/user/john", is_trusted=True, is_banned=False) # dupe
>>> c = Submitter(name="Jane", url="https://nyaa.si/user/jane", is_trusted=False, is_banned=False)

>>> print(a)
John

>>> a == b
True

>>> a == c
False

>>> set((a, b, c)) == {a, c} == {b, c} # dedupe
True

is_banned instance-attribute

is_banned: bool

Indicates whether the user is banned or not.

is_trusted instance-attribute

is_trusted: bool

Indicates whether the user is trusted (green) or not.

name instance-attribute

name: str

Username of the submitter.

url instance-attribute

url: HttpUrl

Profile URL of the submitter.

NyaaTorrentPage

Bases: ParentModel

Model representing Nyaa's torrent page.

Features
  • Immutable
  • Hashable
  • Inherits from pydantic.BaseModel, so you get all of pydantic's fancy methods
  • Supports equality checking (based on the URL)

Examples:

>>> from pynyaa import Nyaa
>>> nyaa = Nyaa()
>>> a = nyaa.get(1839783)
>>> b = nyaa.get(1839783) # dupe
>>> c = nyaa.get(1839609)

>>> print(a)
[SubsPlease] Hibike! Euphonium S3 - 13 (1080p) [230618C3].mkv

>>> a == b
True

>>> a == c
False

>>> set((a, b, c)) == {a, c} == {b, c} # dedupe
True

category instance-attribute

category: Category

Torrent category.

completed instance-attribute

completed: int

Number of completed downloads.

datetime instance-attribute

datetime: UTCDateTime

Date and time at which the torrent was submitted.

description instance-attribute

description: str | None

Torrent description.

id instance-attribute

id: int

Nyaa ID of the torrent (https://nyaa.si/view/{id}).

information instance-attribute

information: str | None

Information about the torrent.

is_remake instance-attribute

is_remake: bool

Indicates whether the upload is a remake (red) or not.

Note

An upload can be both trusted and a remake, in which case, the remake takes priority, that is, is_remake will be True and is_trusted will be False. This is a current limitation that I don't know how to work around.

is_trusted instance-attribute

is_trusted: bool

Indicates whether the upload is trusted (green) or not.

leechers instance-attribute

leechers: int

Number of leechers.

magnet instance-attribute

magnet: MagnetUrl

Magnet link of the torrent.

Note

The magnet link provided by Nyaa is different from the one you'll get if you simply generated it from the .torrent file itself because Nyaa strips away all trackers except it's own and the ones listed here.

seeders instance-attribute

seeders: int

Number of seeders.

submitter instance-attribute

submitter: Submitter

User who submitted the torrent.

title instance-attribute

title: str

Title of the torrent.

torrent instance-attribute

torrent: Torrent

A torf.Torrent object representing the data stored in the .torrent file.

torrent_file instance-attribute

torrent_file: HttpUrl

URL pointing to the .torrent file (https://nyaa.si/download/123456.torrent)

url instance-attribute

url: HttpUrl

URL to the Nyaa torrent page (https://nyaa.si/view/123456).