Fetcher class for retrieving and caching HTML content for shinden.pl pages.

Constructors

  • Creates an instance of Fetcher.

    Parameters

    • anime: Anime

      The anime object containing URLs.

    • Optional maxRetries: number

      The maximum number of retries for fetching a page.

    Returns Fetcher

Properties

_anime: Anime
_cachedEpisodesPageHTML: string = undefined
_cachedMainPageHTML: string = undefined
_cachedPlayersPageHTML: string = undefined
_isCachedEpisodesPageHTMLHealthy: boolean = false
_isCachedMainPageHTMLHealthy: boolean = false
_isCachedPlayersPageHTMLHealthy: boolean = false
_maxRetries: number = 5

Methods

  • Fetches the specified page type and returns the HTML content.

    Parameters

    • pageType: PageType

      The type of page to fetch.

    • Optional episode: Episode

      The episode for fetching players page. Only required when pageType == PageType.PLAYERS.

    Returns Promise<string>

    The HTML content of the fetched page.

    Throws

    Will throw an error if the page cannot be verified or if the response is not OK.

  • Fetches the external player URL for the given player.

    Parameters

    • player: Player

      The player object containing the online ID.

    Returns Promise<URL>

    The external player URL.

  • Fetches the search results page for a given search query name and page number.

    Parameters

    • name: string

      The search query name.

    • Optional page: number

      The page number to fetch.

    • Optional maxRetries: number

      The maximum number of retries for fetching the page.

    Returns Promise<string>

    The HTML content of the search results page.