ParsedAnimeHttpSource

Deprecated

In most cases sources only require a subset of the methods from this class. Source developers should make their own implementation according to their needs.

A simple implementation for sources from a website using Jsoup, an HTML parser.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
abstract val baseUrl: String

Base url of the website without the trailing slash, like: http://mysite.com

Link copied to clipboard

Default network client for doing requests. Implementations can override this property for custom OkHttpClient instances.

Link copied to clipboard

Headers used for requests. Result of headersBuilder

Link copied to clipboard
open override val id: Long

ID of the source. By default it uses a generated id using the first 16 characters (64 bits) of the MD5 of the string "${name.lowercase()}/$lang/$versionId".

Link copied to clipboard
abstract val lang: String

An ISO 639-1 compliant language code (two letters in lower case).

Link copied to clipboard
abstract val name: String

Name of the source.

Link copied to clipboard
protected val network: NetworkHelper

Network service.

Link copied to clipboard
abstract val supportsLatest: Boolean

Whether the source has support for latest updates.

Link copied to clipboard
open val versionId: Int

Version id used to generate the source id. If the site completely changes and urls are incompatible, you may increase this value and it'll be considered as a new source.

Functions

Link copied to clipboard
protected open override fun animeDetailsParse(response: Response): SAnime

Parses the response from the site and returns the details of a anime.

protected abstract fun animeDetailsParse(document: Document): SAnime

Returns the details of the anime from the given document.

Link copied to clipboard

Returns the request for the details of an anime. Override only if it's needed to change the url, send different headers or request method like POST.

Link copied to clipboard
protected abstract fun episodeFromElement(element: Element): SEpisode

Returns a episode from the given element.

Link copied to clipboard
protected open override fun episodeListParse(response: Response): List<SEpisode>

Parses the response from the site and returns a list of episodes.

Link copied to clipboard
protected open fun episodeListRequest(anime: SAnime): Request

Returns the request for updating the episode list. Override only if it's needed to override the url, send different headers or request method like POST.

Link copied to clipboard
protected abstract fun episodeListSelector(): String

Returns the Jsoup selector that returns a list of Element corresponding to each episode.

Link copied to clipboard
protected fun generateId(name: String, lang: String, versionId: Int): Long

Generates a unique ID for the source based on the provided name, lang and versionId. It will use the first 16 characters (64 bits) of the MD5 of the string "${name.lowercase()}/$lang/$versionId".

Link copied to clipboard
open suspend override fun getAnimeDetails(anime: SAnime): SAnime

Get the updated details for an anime. Normally it's not needed to override this method.

Link copied to clipboard
open fun getAnimeUrl(anime: SAnime): String

Returns the url of the provided anime. Useful to fix "open in webview" without overriding getAnimeDetails.

Link copied to clipboard
open suspend override fun getEpisodeList(anime: SAnime): List<SEpisode>

Get all the available episodes for an anime. Normally it's not needed to override this method.

Link copied to clipboard
open fun getEpisodeUrl(episode: SEpisode): String

Returns the url of the provided episode.

Link copied to clipboard
open override fun getFilterList(): AnimeFilterList

Returns the list of filters for the source.

Link copied to clipboard
open suspend override fun getHosterList(episode: SEpisode): List<Hoster>

Get the list of hoster for an episode.

Link copied to clipboard
open suspend fun getLatestUpdates(page: Int): AnimesPage

Get a page with a list of latest anime updates.

Link copied to clipboard
open suspend fun getPopularAnime(page: Int): AnimesPage

Get a page with a list of anime.

Link copied to clipboard
open suspend fun getSearchAnime(page: Int, query: String, filters: AnimeFilterList): AnimesPage

Get a page with a list of anime.

Link copied to clipboard
open suspend override fun getSeasonList(anime: SAnime): List<SAnime>

Get all the available seasons for an anime. Normally it's not needed to override this method.

Link copied to clipboard
open suspend override fun getVideoList(hoster: Hoster): List<Video>

Get the list of videos for a hoster.

Link copied to clipboard
open suspend fun getVideoUrl(video: Video): String
Link copied to clipboard
protected open fun headersBuilder(): Headers.Builder

Headers builder for requests. Implementations can override this method for custom headers.

Link copied to clipboard
protected abstract fun hosterListParse(response: Response): List<Hoster>

Parses the response from the site and returns a list of hosters.

Link copied to clipboard
protected open fun hosterListRequest(episode: SEpisode): Request

Returns the request for getting the hosters. Override only if it's needed to override the url, send different headers or request method like POST.

Link copied to clipboard
protected abstract fun latestUpdatesFromElement(element: Element): SAnime

Returns a anime from the given element. Most sites only show the title and the url, it's totally fine to fill only those two values.

Link copied to clipboard
protected abstract fun latestUpdatesNextPageSelector(): String?

Returns the Jsoup selector that returns the tag linking to the next page, or null if there's no next page.

Link copied to clipboard
protected open override fun latestUpdatesParse(response: Response): AnimesPage

Parses the response from the site and returns a AnimesPage object.

Link copied to clipboard
protected abstract fun latestUpdatesRequest(page: Int): Request

Returns the request for latest anime given the page.

Link copied to clipboard
protected abstract fun latestUpdatesSelector(): String

Returns the Jsoup selector that returns a list of Element corresponding to each anime.

Link copied to clipboard
protected abstract fun popularAnimeFromElement(element: Element): SAnime

Returns a anime from the given element. Most sites only show the title and the url, it's totally fine to fill only those two values.

Link copied to clipboard
protected abstract fun popularAnimeNextPageSelector(): String?

Returns the Jsoup selector that returns the tag linking to the next page, or null if there's no next page.

Link copied to clipboard
protected open override fun popularAnimeParse(response: Response): AnimesPage

Parses the response from the site and returns a AnimesPage object.

Link copied to clipboard
protected abstract fun popularAnimeRequest(page: Int): Request

Returns the request for the popular anime given the page.

Link copied to clipboard
protected abstract fun popularAnimeSelector(): String

Returns the Jsoup selector that returns a list of Element corresponding to each anime.

Link copied to clipboard
open fun prepareNewEpisode(episode: SEpisode, anime: SAnime)

Called before inserting a new episode into database. Use it if you need to override episode fields, like the title or the episode number. Do not change anything to anime.

Link copied to clipboard
open suspend fun resolveVideo(video: Video): Video?

Returns the resolved video of the episode link. Override only if it's needed to resolve the video.

Link copied to clipboard
protected abstract fun searchAnimeFromElement(element: Element): SAnime

Returns a anime from the given element. Most sites only show the title and the url, it's totally fine to fill only those two values.

Link copied to clipboard
protected abstract fun searchAnimeNextPageSelector(): String?

Returns the Jsoup selector that returns the tag linking to the next page, or null if there's no next page.

Link copied to clipboard
protected open override fun searchAnimeParse(response: Response): AnimesPage

Parses the response from the site and returns a AnimesPage object.

Link copied to clipboard
protected abstract fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request

Returns the request for the search anime given the page and filters.

Link copied to clipboard
protected abstract fun searchAnimeSelector(): String

Returns the Jsoup selector that returns a list of Element corresponding to each anime.

Link copied to clipboard
protected abstract fun seasonFromElement(element: Element): SAnime

Returns a season from the given element.

Link copied to clipboard
protected open override fun seasonListParse(response: Response): List<SAnime>

Parses the response from the site and returns a list of seasons.

Link copied to clipboard
protected open fun seasonListRequest(anime: SAnime): Request

Returns the request for updating the season list. Override only if it's needed to override the url, send different headers or request method like POST.

Link copied to clipboard
protected abstract fun seasonListSelector(): String

Returns the Jsoup selector that returns a list of Element corresponding to each season.

Link copied to clipboard

Assigns the url of the anime without the scheme and domain. It saves some redundancy from database and the urls could still work after a domain change.

Assigns the url of the episode without the scheme and domain. It saves some redundancy from database and the urls could still work after a domain change.

Link copied to clipboard

Sorts the hoster list. Override this according to the user's preference. This function is called by the app and should not be called in the extension.

Link copied to clipboard
protected open fun List<Video>.sortVideos(): List<Video>

Sorts the video list for a hoster. Override this according to the user's preference. This function is called by the app and should not be called in the extension.

Link copied to clipboard
open override fun toString(): String

Visible name of the source.

Link copied to clipboard
protected open fun videoListParse(response: Response, hoster: Hoster): List<Video>

Parses the response from the hoster and returns a list of videos.

Link copied to clipboard
protected open fun videoListRequest(hoster: Hoster): Request

Returns the request for getting the hosters. Override only if it's needed to override the url, send different headers or request method like POST.

Link copied to clipboard
protected open fun videoUrlParse(response: Response): String
Link copied to clipboard
protected open fun videoUrlRequest(video: Video): Request

Returns the request for getting the url to the source video. Override only if it's needed to override the url, send different headers or request method like POST.