Module hdrezka.post.favorites
Favorites collection page (/favorites/[id]).
Classes
class Favorites (cat_id: typing.SupportsInt | str | None = None, *, client: HDRezkaClient)-
Expand source code
class Favorites(Page): """ Paginated favorites collection page. Titles are loaded via the usual ``get_page`` / ``get_page_content`` methods. Collection links on the same HTML are available through ``get_cats``. """ __slots__ = ('_cat_id',) def __init__(self, cat_id: SupportsInt | str | None = None, *, client: 'HDRezkaClient'): """ :param cat_id: Collection id for ``/favorites/{id}/``, or ``None`` for ``/favorites/``. :param client: Authenticated session (favorites require login). """ self._cat_id = None if cat_id is None else int(cat_id) if self._cat_id is None: url = client.host_join('favorites/') else: url = client.host_join(f'favorites/{self._cat_id}/') super().__init__(url, client=client) @property def cat_id(self) -> int | None: """Collection id for this page, if any.""" return self._cat_id async def get_cats(self) -> tuple[FavoritesCat, ...]: """ Fetch this favorites page and parse the collection list. Returns an empty tuple when the list markup is missing. """ html = (await self.client.get_response('GET', self._page)).text return parse_favorites_cats(html)Paginated favorites collection page.
Titles are loaded via the usual
get_page/get_page_contentmethods. Collection links on the same HTML are available throughget_cats.:param cat_id: Collection id for
/favorites/{id}/, orNonefor/favorites/. :param client: Authenticated session (favorites require login).Ancestors
Instance variables
prop cat_id : int | None-
Expand source code
@property def cat_id(self) -> int | None: """Collection id for this page, if any.""" return self._cat_idCollection id for this page, if any.
Methods
async def get_cats(self) ‑> tuple[FavoritesCat, ...]-
Expand source code
async def get_cats(self) -> tuple[FavoritesCat, ...]: """ Fetch this favorites page and parse the collection list. Returns an empty tuple when the list markup is missing. """ html = (await self.client.get_response('GET', self._page)).text return parse_favorites_cats(html)Fetch this favorites page and parse the collection list.
Returns an empty tuple when the list markup is missing.
Inherited members