pynyaasi.sukebei

SUKEBEI_ENDPOINT

pynyaasi.sukebei.SUKEBEI_ENDPOINT = 'https://sukebei.nyaa.si'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

CategoryType

enum pynyaasi.sukebei.CategoryType(value)[source]

An enumeration.

Member Type:

str

Valid values are as follows:

ALL_CATEGORIES = <CategoryType.ALL_CATEGORIES: '0_0'>
ART = <CategoryType.ART: '1_0'>
ART_ANIME = <CategoryType.ART_ANIME: '1_1'>
ART_DOUJINSHI = <CategoryType.ART_DOUJINSHI: '1_2'>
ART_GAMES = <CategoryType.ART_GAMES: '1_3'>
ART_MANGA = <CategoryType.ART_MANGA: '1_4'>
ART_PICTURES = <CategoryType.ART_PICTURES: '1_5'>
REAL_LIFE = <CategoryType.REAL_LIFE: '2_0'>
REAL_LIFE_PICTURES = <CategoryType.REAL_LIFE_PICTURES: '2_1'>
REAL_LIFE_VIDEOS = <CategoryType.REAL_LIFE_VIDEOS: '2_2'>

FilterType

enum pynyaasi.sukebei.FilterType(value)[source]

An enumeration.

Member Type:

str

Valid values are as follows:

NO_FILTER = <FilterType.NO_FILTER: '0'>
NO_REMAKES = <FilterType.NO_REMAKES: '1'>
TRUSTED_ONLY = <FilterType.TRUSTED_ONLY: '2'>

SukebeiClient

class pynyaasi.sukebei.SukebeiClient(session: Optional[requests.Session] = None)[source]

A client class for accessing the sukebei.nyaa.si website.

The SukebeiClient class is a subclass of BaseClient and provides specific functionality for accessing the sukebei.nyaa.si website, which hosts adult content.

Parameters:

session (Optional[requests.Session]) – An optional requests.Session object to be used for making HTTP requests.

Variables:
  • __endpoint__ (str) – The base endpoint URL for the sukebei.nyaa.si website.

  • __filter_class__ (FilterType) – The available filter options for search queries on sukebei.nyaa.si.

  • __default_filter__ (FilterType) – The default filter option for search queries on sukebei.nyaa.si.

  • __category_class__ (CategoryType) – The available category options for search queries on sukebei.nyaa.si.

  • __default_category__ (CategoryType) – The default category option for search queries on sukebei.nyaa.si.

__init__(session: Optional[requests.Session] = None)[source]

Initialize a new SukebeiClient instance.

Parameters:

session (Optional[requests.Session]) – An optional requests.Session object to be used for making HTTP requests.

get_resource(id_: int)

Retrieves detailed information about a resource.

Parameters:

id (int) – The ID of the resource.

Returns:

A ResourceItem object with resource details.

Return type:

ResourceItem

iter_items(query: str = '', filter=Ellipsis, category=Ellipsis, sort_by=None, order=<Order.DESC: 'desc'>, from_page: int = 1)

Iterates through items on the website with paging support.

Parameters:
  • query (str) – The search query.

  • filter – The filter for items.

  • category – The category for items.

  • sort_by – The sorting option.

  • order (Order) – The sorting order (ascending or descending).

  • from_page (1) – The page number to start from.

Returns:

An iterator of ListItem objects.

Return type:

Iterator[ListItem]

iter_items_by_page(query: str = '', filter=Ellipsis, category=Ellipsis, sort_by=None, order=<Order.DESC: 'desc'>, page: int = 1) → Iterator[pynyaasi.client.client.ListItem]

Iterates through items on the website by page.

Parameters:
  • query (str) – The search query.

  • filter – The filter for items.

  • category – The category for items.

  • sort_by – The sorting option.

  • order (Order) – The sorting order (ascending or descending).

  • page (1) – The page number to start from.

Returns:

An iterator of ListItem objects.

Return type:

Iterator[ListItem]