Adapt source implementation for TachiyomiX 1.6 (#3243)

This commit is contained in:
AntsyLich
2026-06-14 02:34:31 +06:00
committed by GitHub
parent 430b13bb81
commit 4c37f4c764
38 changed files with 597 additions and 524 deletions
@@ -2,6 +2,12 @@ package eu.kanade.tachiyomi.source
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.SMangaUpdate
import kotlinx.coroutines.async
import kotlinx.coroutines.supervisorScope
import rx.Observable
import tachiyomi.core.common.util.lang.awaitSingle
@@ -12,69 +18,61 @@ interface CatalogueSource : Source {
*/
override val lang: String
/**
* Whether the source has support for latest updates.
*/
val supportsLatest: Boolean
/**
* Get a page with a list of manga.
*
* @since extensions-lib 1.5
* @param page the page number to retrieve.
*/
@Suppress("DEPRECATION")
suspend fun getPopularManga(page: Int): MangasPage {
return fetchPopularManga(page).awaitSingle()
override suspend fun getPopularManga(page: Int): MangasPage = fetchPopularManga(page).awaitSingle()
@Suppress("DEPRECATION")
override suspend fun getLatestUpdates(page: Int): MangasPage = fetchLatestUpdates(page).awaitSingle()
@Suppress("DEPRECATION")
override suspend fun getSearchManga(
page: Int,
query: String,
filters: FilterList,
): MangasPage = fetchSearchManga(page, query, filters).awaitSingle()
@Suppress("DEPRECATION")
override suspend fun getMangaUpdate(
manga: SManga,
chapters: List<SChapter>,
fetchDetails: Boolean,
fetchChapters: Boolean,
): SMangaUpdate = supervisorScope {
val asyncManga = if (fetchDetails) async { fetchMangaDetails(manga).awaitSingle() } else null
val asyncChapters = if (fetchChapters) async { fetchChapterList(manga).awaitSingle() } else null
SMangaUpdate(asyncManga?.await() ?: manga, asyncChapters?.await() ?: chapters)
}
@Suppress("DEPRECATION")
override suspend fun getPageList(chapter: SChapter): List<Page> = fetchPageList(chapter).awaitSingle()
/**
* Get a page with a list of manga.
* Returns an observable containing a page with a list of manga.
*
* @param page the page number to retrieve.
*/
@Deprecated("Use the suspend API instead", ReplaceWith("getPopularManga"))
fun fetchPopularManga(page: Int): Observable<MangasPage> = throw UnsupportedOperationException()
/**
* Returns an observable containing a page with a list of manga.
*
* @since extensions-lib 1.5
* @param page the page number to retrieve.
* @param query the search query.
* @param filters the list of filters to apply.
*/
@Suppress("DEPRECATION")
suspend fun getSearchManga(page: Int, query: String, filters: FilterList): MangasPage {
return fetchSearchManga(page, query, filters).awaitSingle()
}
@Deprecated("Use the suspend API instead", ReplaceWith("getSearchManga"))
fun fetchSearchManga(
page: Int,
query: String,
filters: FilterList,
): Observable<MangasPage> = throw UnsupportedOperationException()
/**
* Get a page with a list of latest manga updates.
* Returns an observable containing a page with a list of latest manga updates.
*
* @since extensions-lib 1.5
* @param page the page number to retrieve.
*/
@Suppress("DEPRECATION")
suspend fun getLatestUpdates(page: Int): MangasPage {
return fetchLatestUpdates(page).awaitSingle()
}
/**
* Returns the list of filters for the source.
*/
fun getFilterList(): FilterList
@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getPopularManga"),
)
fun fetchPopularManga(page: Int): Observable<MangasPage> =
throw IllegalStateException("Not used")
@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getSearchManga"),
)
fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> =
throw IllegalStateException("Not used")
@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getLatestUpdates"),
)
fun fetchLatestUpdates(page: Int): Observable<MangasPage> =
throw IllegalStateException("Not used")
@Deprecated("Use the suspend API instead", ReplaceWith("getLatestUpdates"))
fun fetchLatestUpdates(page: Int): Observable<MangasPage> = throw UnsupportedOperationException()
}
@@ -1,13 +1,15 @@
package eu.kanade.tachiyomi.source
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.awaitSingle
import eu.kanade.tachiyomi.source.model.SMangaUpdate
import rx.Observable
/**
* A basic interface for creating a source. It could be an online source, a local source, etc.
* A basic interface for creating a source. It could be an online source, a local source, etc...
*/
interface Source {
@@ -25,60 +27,80 @@ interface Source {
get() = ""
/**
* Get the updated details for a manga.
*
* @since extensions-lib 1.5
* @param manga the manga to update.
* @return the updated manga.
* Whether the source has support for latest updates.
*/
@Suppress("DEPRECATION")
suspend fun getMangaDetails(manga: SManga): SManga {
return fetchMangaDetails(manga).awaitSingle()
}
val supportsLatest: Boolean
/**
* Get all the available chapters for a manga.
*
* @since extensions-lib 1.5
* @param manga the manga to update.
* @return the chapters for the manga.
* Returns the list of filters for the source.
*/
@Suppress("DEPRECATION")
suspend fun getChapterList(manga: SManga): List<SChapter> {
return fetchChapterList(manga).awaitSingle()
}
fun getFilterList(): FilterList = FilterList()
/**
* Get a page with a list of manga.
*
* @since tachiyomix 1.6
* @param page the page number to retrieve.
*/
suspend fun getPopularManga(page: Int): MangasPage
/**
* Get a page with a list of latest manga updates.
*
* @since tachiyomix 1.6
* @param page the page number to retrieve.
*/
suspend fun getLatestUpdates(page: Int): MangasPage
/**
* Get a page with a list of manga.
*
* @since tachiyomix 1.6
* @param page the page number to retrieve.
* @param query the search query.
* @param filters the list of filters to apply.
*/
suspend fun getSearchManga(page: Int, query: String, filters: FilterList): MangasPage
/**
* Fetches updated information for a manga.
*
* Depending on the provided flags or source availability, this may include
* updated manga metadata, available chapters, or both.
*
* If a value is not requested, the existing provided value can be returned as-is.
* The host app may apply any returned updates regardless of the flags,
* so care should be taken to only return accurate and intentional changes.
*
* @since tachiyomix 1.6
* @param manga The manga to fetch updates for.
* @param chapters Existing chapters of the manga
* @param fetchDetails Whether to fetch updated manga details.
* @param fetchChapters Whether to fetch available chapters.
*/
suspend fun getMangaUpdate(
manga: SManga,
chapters: List<SChapter>,
fetchDetails: Boolean,
fetchChapters: Boolean,
): SMangaUpdate
/**
* Get the list of pages a chapter has. Pages should be returned
* in the expected order; the index is ignored.
*
* @since extensions-lib 1.5
* @since tachiyomix 1.6
* @param chapter the chapter.
* @return the pages for the chapter.
*/
@Suppress("DEPRECATION")
suspend fun getPageList(chapter: SChapter): List<Page> {
return fetchPageList(chapter).awaitSingle()
}
suspend fun getPageList(chapter: SChapter): List<Page>
@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getMangaDetails"),
)
fun fetchMangaDetails(manga: SManga): Observable<SManga> =
throw IllegalStateException("Not used")
@Deprecated("Use the combined suspend API instead", ReplaceWith("getMangaUpdate"))
fun fetchMangaDetails(manga: SManga): Observable<SManga> = throw UnsupportedOperationException()
@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getChapterList"),
)
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> =
throw IllegalStateException("Not used")
@Deprecated("Use the combined suspend API instead", ReplaceWith("getMangaUpdate"))
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = throw UnsupportedOperationException()
@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getPageList"),
)
fun fetchPageList(chapter: SChapter): Observable<List<Page>> =
throw IllegalStateException("Not used")
@Deprecated("Use the suspend API instead", ReplaceWith("getPageList"))
fun fetchPageList(chapter: SChapter): Observable<List<Page>> = throw UnsupportedOperationException()
}
@@ -0,0 +1,4 @@
package eu.kanade.tachiyomi.source.model
@Suppress("UNUSED")
class SMangaUpdate(val manga: SManga, val chapters: List<SChapter>)
@@ -25,7 +25,6 @@ import java.security.MessageDigest
/**
* A simple implementation for sources from a website.
*/
@Suppress("unused")
abstract class HttpSource : CatalogueSource {
/**
@@ -38,11 +37,24 @@ abstract class HttpSource : CatalogueSource {
*/
abstract val baseUrl: String
/**
* Returns the base (home) URL of the website as a string.
*
* This is typically the root address that serves as the main entry point
* to the site's content, such as "https://mihon.tech".
*
* This method is used in the browse screen to determine the URL
* opened when tapping "Open in WebView".
*
* @return The websites home page URL. Defaults to [baseUrl].
*/
open fun getHomeUrl(): String = baseUrl
/**
* 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.
*/
open val versionId = 1
open val versionId: Int = 1
/**
* ID of the source. By default it uses a generated id using the first 16 characters (64 bits)
@@ -54,7 +66,7 @@ abstract class HttpSource : CatalogueSource {
*
* Note: the generated ID sets the sign bit to `0`.
*/
override val id by lazy { generateId(name, lang, versionId) }
override val id: Long by lazy { generateId(name, lang, versionId) }
/**
* Headers used for requests.
@@ -64,8 +76,7 @@ abstract class HttpSource : CatalogueSource {
/**
* Default network client for doing requests.
*/
open val client: OkHttpClient
get() = network.client
open val client: OkHttpClient get() = network.client
/**
* Generates a unique ID for the source based on the provided [name], [lang] and
@@ -93,14 +104,14 @@ abstract class HttpSource : CatalogueSource {
/**
* Headers builder for requests. Implementations can override this method for custom headers.
*/
protected open fun headersBuilder() = Headers.Builder().apply {
protected open fun headersBuilder(): Headers.Builder = Headers.Builder().apply {
add("User-Agent", network.defaultUserAgentProvider())
}
/**
* Visible name of the source.
*/
override fun toString() = "$name (${lang.uppercase()})"
override fun toString(): String = "$name (${lang.uppercase()})"
/**
* Returns an observable containing a page with a list of manga. Normally it's not needed to
@@ -109,7 +120,7 @@ abstract class HttpSource : CatalogueSource {
* @param page the page number to retrieve.
*/
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getPopularManga"))
@Deprecated("Use the suspend API instead", ReplaceWith("getPopularManga"))
override fun fetchPopularManga(page: Int): Observable<MangasPage> {
return client.newCall(popularMangaRequest(page))
.asObservableSuccess()
@@ -123,14 +134,22 @@ abstract class HttpSource : CatalogueSource {
*
* @param page the page number to retrieve.
*/
protected abstract fun popularMangaRequest(page: Int): Request
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun popularMangaRequest(page: Int): Request = throw UnsupportedOperationException()
/**
* Parses the response from the site and returns a [MangasPage] object.
*
* @param response the response from the site.
*/
protected abstract fun popularMangaParse(response: Response): MangasPage
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun popularMangaParse(response: Response): MangasPage = throw UnsupportedOperationException()
/**
* Returns an observable containing a page with a list of manga. Normally it's not needed to
@@ -141,21 +160,10 @@ abstract class HttpSource : CatalogueSource {
* @param filters the list of filters to apply.
*/
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getSearchManga"))
override fun fetchSearchManga(
page: Int,
query: String,
filters: FilterList,
): Observable<MangasPage> {
return Observable.defer {
try {
client.newCall(searchMangaRequest(page, query, filters)).asObservableSuccess()
} catch (e: NoClassDefFoundError) {
// RxJava doesn't handle Errors, which tends to happen during global searches
// if an old extension using non-existent classes is still around
throw RuntimeException(e)
}
}
@Deprecated("Use the suspend API instead", ReplaceWith("getSearchManga"))
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return client.newCall(searchMangaRequest(page, query, filters))
.asObservableSuccess()
.map { response ->
searchMangaParse(response)
}
@@ -168,18 +176,26 @@ abstract class HttpSource : CatalogueSource {
* @param query the search query.
* @param filters the list of filters to apply.
*/
protected abstract fun searchMangaRequest(
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun searchMangaRequest(
page: Int,
query: String,
filters: FilterList,
): Request
): Request = throw UnsupportedOperationException()
/**
* Parses the response from the site and returns a [MangasPage] object.
*
* @param response the response from the site.
*/
protected abstract fun searchMangaParse(response: Response): MangasPage
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun searchMangaParse(response: Response): MangasPage = throw UnsupportedOperationException()
/**
* Returns an observable containing a page with a list of latest manga updates.
@@ -187,7 +203,7 @@ abstract class HttpSource : CatalogueSource {
* @param page the page number to retrieve.
*/
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getLatestUpdates"))
@Deprecated("Use the suspend API instead", ReplaceWith("getLatestUpdates"))
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> {
return client.newCall(latestUpdatesRequest(page))
.asObservableSuccess()
@@ -201,29 +217,31 @@ abstract class HttpSource : CatalogueSource {
*
* @param page the page number to retrieve.
*/
protected abstract fun latestUpdatesRequest(page: Int): Request
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException()
/**
* Parses the response from the site and returns a [MangasPage] object.
*
* @param response the response from the site.
*/
protected abstract fun latestUpdatesParse(response: Response): MangasPage
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun latestUpdatesParse(response: Response): MangasPage = throw UnsupportedOperationException()
/**
* Get the updated details for a manga.
* Normally it's not needed to override this method.
* Returns an observable with the updated details for a manga. Normally it's not needed to
* override this method.
*
* @param manga the manga to update.
* @return the updated manga.
* @param manga the manga to be updated.
*/
@Suppress("DEPRECATION")
override suspend fun getMangaDetails(manga: SManga): SManga {
return fetchMangaDetails(manga).awaitSingle()
}
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getMangaDetails"))
@Deprecated("Use the combined suspend API instead", replaceWith = ReplaceWith("getMangaUpdate"))
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
return client.newCall(mangaDetailsRequest(manga))
.asObservableSuccess()
@@ -238,6 +256,10 @@ abstract class HttpSource : CatalogueSource {
*
* @param manga the manga to be updated.
*/
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
open fun mangaDetailsRequest(manga: SManga): Request {
return GET(baseUrl + manga.url, headers)
}
@@ -247,22 +269,20 @@ abstract class HttpSource : CatalogueSource {
*
* @param response the response from the site.
*/
protected abstract fun mangaDetailsParse(response: Response): SManga
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun mangaDetailsParse(response: Response): SManga = throw UnsupportedOperationException()
/**
* Get all the available chapters for a manga.
* Normally it's not needed to override this method.
* Returns an observable with the updated chapter list for a manga. Normally it's not needed to
* override this method.
*
* @param manga the manga to update.
* @return the chapters for the manga.
* @param manga the manga to look for chapters.
*/
@Suppress("DEPRECATION")
override suspend fun getChapterList(manga: SManga): List<SChapter> {
return fetchChapterList(manga).awaitSingle()
}
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getChapterList"))
@Deprecated("Use the combined suspend API instead", replaceWith = ReplaceWith("getMangaUpdate"))
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
return client.newCall(chapterListRequest(manga))
.asObservableSuccess()
@@ -277,6 +297,10 @@ abstract class HttpSource : CatalogueSource {
*
* @param manga the manga to look for chapters.
*/
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun chapterListRequest(manga: SManga): Request {
return GET(baseUrl + manga.url, headers)
}
@@ -286,29 +310,19 @@ abstract class HttpSource : CatalogueSource {
*
* @param response the response from the site.
*/
protected abstract fun chapterListParse(response: Response): List<SChapter>
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun chapterListParse(response: Response): List<SChapter> = throw UnsupportedOperationException()
/**
* Parses the response from the site and returns a SChapter Object.
* Returns an observable with the page list for a chapter.
*
* @param response the response from the site.
*/
protected abstract fun chapterPageParse(response: Response): SChapter
/**
* Get the list of pages a chapter has. Pages should be returned
* in the expected order; the index is ignored.
*
* @param chapter the chapter.
* @return the pages for the chapter.
* @param chapter the chapter whose page list has to be fetched.
*/
@Suppress("DEPRECATION")
override suspend fun getPageList(chapter: SChapter): List<Page> {
return fetchPageList(chapter).awaitSingle()
}
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getPageList"))
@Deprecated("Use the suspend API instead", ReplaceWith("getPageList"))
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
return client.newCall(pageListRequest(chapter))
.asObservableSuccess()
@@ -323,6 +337,10 @@ abstract class HttpSource : CatalogueSource {
*
* @param chapter the chapter whose page list has to be fetched.
*/
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun pageListRequest(chapter: SChapter): Request {
return GET(baseUrl + chapter.url, headers)
}
@@ -332,34 +350,45 @@ abstract class HttpSource : CatalogueSource {
*
* @param response the response from the site.
*/
protected abstract fun pageListParse(response: Response): List<Page>
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun pageListParse(response: Response): List<Page> = throw UnsupportedOperationException()
/**
* Returns an observable with the page containing the source url of the image. If there's any
* error, it will return null instead of throwing an exception.
*
* @since extensions-lib 1.5
* @param page the page whose source image has to be fetched.
*/
@Suppress("DEPRECATION")
open suspend fun getImageUrl(page: Page): String {
return fetchImageUrl(page).awaitSingle()
}
@Suppress("DEPRECATION")
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getImageUrl"))
@Deprecated("Use the suspend API instead", ReplaceWith("getImageUrl"))
open fun fetchImageUrl(page: Page): Observable<String> {
return client.newCall(imageUrlRequest(page))
.asObservableSuccess()
.map { imageUrlParse(it) }
}
/**
* Returns the image url for the provided [page]. The function is only called if [Page.imageUrl] is null.
*
* @since tachiyomix 1.6
* @param page the page whose source image has to be fetched.
*/
@Suppress("DEPRECATION")
open suspend fun getImageUrl(page: Page): String = fetchImageUrl(page).awaitSingle()
/**
* Returns the request for getting the url to the source image. Override only if it's needed to
* override the url, send different headers or request method like POST.
*
* @param page the chapter whose page list has to be fetched
*/
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun imageUrlRequest(page: Page): Request {
return GET(page.url, headers)
}
@@ -369,16 +398,13 @@ abstract class HttpSource : CatalogueSource {
*
* @param response the response from the site.
*/
protected abstract fun imageUrlParse(response: Response): String
@Deprecated(
message = "The helper functions are inherently limiting and hides the underlying implementation. " +
"Source developers should make their own implementation according to their needs.",
)
protected open fun imageUrlParse(response: Response): String = throw UnsupportedOperationException()
/**
* Returns the response of the source image.
* Typically does not need to be overridden.
*
* @since extensions-lib 1.5
* @param page the page whose source image has to be downloaded.
*/
open suspend fun getImage(page: Page): Response {
suspend fun getImage(page: Page): Response {
return client.newCachelessCallWithProgress(imageRequest(page), page)
.awaitSuccess()
}
@@ -399,6 +425,7 @@ abstract class HttpSource : CatalogueSource {
*
* @param url the full url to the chapter.
*/
@Suppress("Unused")
fun SChapter.setUrlWithoutDomain(url: String) {
this.url = getUrlWithoutDomain(url)
}
@@ -409,6 +436,7 @@ abstract class HttpSource : CatalogueSource {
*
* @param url the full url to the manga.
*/
@Suppress("Unused")
fun SManga.setUrlWithoutDomain(url: String) {
this.url = getUrlWithoutDomain(url)
}
@@ -429,7 +457,7 @@ abstract class HttpSource : CatalogueSource {
out += "#" + uri.fragment
}
out
} catch (e: URISyntaxException) {
} catch (_: URISyntaxException) {
orig
}
}
@@ -441,6 +469,7 @@ abstract class HttpSource : CatalogueSource {
* @param manga the manga
* @return url of the manga
*/
@Suppress("DEPRECATION")
open fun getMangaUrl(manga: SManga): String {
return mangaDetailsRequest(manga).url.toString()
}
@@ -452,6 +481,7 @@ abstract class HttpSource : CatalogueSource {
* @param chapter the chapter
* @return url of the chapter
*/
@Suppress("DEPRECATION")
open fun getChapterUrl(chapter: SChapter): String {
return pageListRequest(chapter).url.toString()
}
@@ -463,10 +493,6 @@ abstract class HttpSource : CatalogueSource {
* @param chapter the chapter to be added.
* @param manga the manga of the chapter.
*/
@Deprecated("All modifications should be done when constructing the chapter")
open fun prepareNewChapter(chapter: SChapter, manga: SManga) {}
/**
* Returns the list of filters for the source.
*/
override fun getFilterList() = FilterList()
}
@@ -12,7 +12,10 @@ import org.jsoup.nodes.Element
/**
* A simple implementation for sources from a website using Jsoup, an HTML parser.
*/
@Suppress("unused")
@Deprecated(
message = "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.",
)
abstract class ParsedHttpSource : HttpSource() {
/**
@@ -20,6 +23,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
@@ -58,6 +64,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun searchMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
@@ -96,6 +105,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun latestUpdatesParse(response: Response): MangasPage {
val document = response.asJsoup()
@@ -134,6 +146,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun mangaDetailsParse(response: Response): SManga {
return mangaDetailsParse(response.asJsoup())
}
@@ -150,6 +165,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
return document.select(chapterListSelector()).map { chapterFromElement(it) }
@@ -172,6 +190,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun pageListParse(response: Response): List<Page> {
return pageListParse(response.asJsoup())
}
@@ -188,6 +209,9 @@ abstract class ParsedHttpSource : HttpSource() {
*
* @param response the response from the site.
*/
@Deprecated(
"The helper functions are inherently limiting and hides the underlying implementation. Source developers should make their own implementation according to their needs.",
)
override fun imageUrlParse(response: Response): String {
return imageUrlParse(response.asJsoup())
}