Skip to content

Author Service

The AuthorService provides search capabilities for authors on Skoob. It scrapes Skoob's HTML pages and returns lightweight results with the following fields:

  • id: numeric identifier extracted from the author URL
  • name: the author's display name
  • nickname: nickname shown below the name
  • url: absolute URL to the author's page on Skoob
  • img_url: avatar image URL

Skoob displays publication, reader and follower counts on the search results page, but these values are often outdated when compared with the author's profile page. To avoid exposing misleading data, AuthorService intentionally omits these numbers.

Example

from pyskoob import SkoobClient

with SkoobClient() as client:
    results = client.authors.search("Asimov")
    for author in results.results:
        print(author.name, author.id)
    if results.has_next_page:
        # fetch the next page of results
        more_results = client.authors.search("Asimov", page=results.next_page)

search() returns only the first page of results. Use results.has_next_page to fetch additional pages.

Services for retrieving authors and their works from Skoob.

AsyncAuthorService

Bases: _AuthorServiceMixin, AsyncBaseSkoobService

Asynchronous variant of :class:AuthorService.

Source code in pyskoob/authors.py
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
class AsyncAuthorService(_AuthorServiceMixin, AsyncBaseSkoobService):  # pragma: no cover - thin async wrapper
    """Asynchronous variant of :class:`AuthorService`."""

    def __init__(self, client: AsyncHTTPClient):
        super().__init__(client)

    async def search(self, query: str, page: int = 1) -> Pagination[AuthorSearchResult]:
        """Asynchronous wrapper around :meth:`_search`."""

        return await self._search(query, page)

    async def get_by_id(self, author_id: int) -> AuthorProfile:
        """Asynchronous wrapper around :meth:`_get_by_id`."""

        return await self._get_by_id(author_id)

    async def get_books(self, author_id: int, page: int = 1) -> Pagination[BookSearchResult]:
        """Asynchronous wrapper around :meth:`_get_books`."""

        return await self._get_books(author_id, page)

get_books(author_id, page=1) async

Asynchronous wrapper around :meth:_get_books.

Source code in pyskoob/authors.py
183
184
185
186
async def get_books(self, author_id: int, page: int = 1) -> Pagination[BookSearchResult]:
    """Asynchronous wrapper around :meth:`_get_books`."""

    return await self._get_books(author_id, page)

get_by_id(author_id) async

Asynchronous wrapper around :meth:_get_by_id.

Source code in pyskoob/authors.py
178
179
180
181
async def get_by_id(self, author_id: int) -> AuthorProfile:
    """Asynchronous wrapper around :meth:`_get_by_id`."""

    return await self._get_by_id(author_id)

search(query, page=1) async

Asynchronous wrapper around :meth:_search.

Source code in pyskoob/authors.py
173
174
175
176
async def search(self, query: str, page: int = 1) -> Pagination[AuthorSearchResult]:
    """Asynchronous wrapper around :meth:`_search`."""

    return await self._search(query, page)

AuthorService

Bases: _AuthorServiceMixin, BaseSkoobService

High level operations for retrieving authors.

Source code in pyskoob/authors.py
151
152
153
154
155
156
157
158
159
160
161
162
163
164
class AuthorService(_AuthorServiceMixin, BaseSkoobService):
    """High level operations for retrieving authors."""

    def search(self, query: str, page: int = 1) -> Pagination[AuthorSearchResult]:
        """Synchronous wrapper around :meth:`_search`."""
        return run_sync(self._search(query, page))

    def get_by_id(self, author_id: int) -> AuthorProfile:
        """Synchronous wrapper around :meth:`_get_by_id`."""
        return run_sync(self._get_by_id(author_id))

    def get_books(self, author_id: int, page: int = 1) -> Pagination[BookSearchResult]:
        """Synchronous wrapper around :meth:`_get_books`."""
        return run_sync(self._get_books(author_id, page))

get_books(author_id, page=1)

Synchronous wrapper around :meth:_get_books.

Source code in pyskoob/authors.py
162
163
164
def get_books(self, author_id: int, page: int = 1) -> Pagination[BookSearchResult]:
    """Synchronous wrapper around :meth:`_get_books`."""
    return run_sync(self._get_books(author_id, page))

get_by_id(author_id)

Synchronous wrapper around :meth:_get_by_id.

Source code in pyskoob/authors.py
158
159
160
def get_by_id(self, author_id: int) -> AuthorProfile:
    """Synchronous wrapper around :meth:`_get_by_id`."""
    return run_sync(self._get_by_id(author_id))

search(query, page=1)

Synchronous wrapper around :meth:_search.

Source code in pyskoob/authors.py
154
155
156
def search(self, query: str, page: int = 1) -> Pagination[AuthorSearchResult]:
    """Synchronous wrapper around :meth:`_search`."""
    return run_sync(self._search(query, page))