Add a new source to GigaViewer (closes #11376). (#11448)

This commit is contained in:
Alessandro Jean 2022-04-12 17:46:07 -03:00 committed by GitHub
parent 9389831dc1
commit 6ca2749e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 75 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,74 @@
package eu.kanade.tachiyomi.extension.ja.corocoroonline
import eu.kanade.tachiyomi.multisrc.gigaviewer.GigaViewer
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Element
import rx.Observable
class CorocoroOnline : GigaViewer(
"Corocoro Online",
"https://corocoro.jp",
"ja",
"https://cdn-img.www.corocoro.jp/public/page"
) {
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(::imageIntercept)
.build()
override val publisher = "小学館"
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/manga", headers)
override fun popularMangaSelector(): String = "ul.p-list-manga li.p-wp-list-item > a"
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.selectFirst("h3.p-article-title")!!.text()
.substringBefore("")
.trim()
thumbnail_url = element.selectFirst("img")!!.attr("src")
setUrlWithoutDomain(element.attr("href"))
}
override fun latestUpdatesSelector(): String = "div.p-manga-today a.p-article-wrap"
// Site doesn't have a manga search and only returns news in search results.
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return client.newCall(popularMangaRequest(page))
.asObservableSuccess()
.map(::popularMangaParse)
.map { allManga ->
val filteredManga = allManga.mangas.filter { manga ->
manga.title.contains(query, true)
}
MangasPage(filteredManga, hasNextPage = false)
}
}
// The chapters only load using the URL with 'www'.
override fun mangaDetailsRequest(manga: SManga): Request =
GET(BASE_URL_WWW + manga.url, headers)
override fun chapterListRequest(manga: SManga): Request = mangaDetailsRequest(manga)
override fun pageListRequest(chapter: SChapter): Request =
GET(BASE_URL_WWW + chapter.url, headers)
// All chapters seems to be free.
override fun chapterListSelector(): String = "li.episode"
// The source have no collections, so no need to have filters.
override fun getFilterList(): FilterList = FilterList()
companion object {
private const val BASE_URL_WWW = "https://www.corocoro.jp"
}
}

View File

@ -15,6 +15,7 @@ class GigaViewerGenerator : ThemeSourceGenerator {
SingleLang("Comic Days", "https://comic-days.com", "ja"),
SingleLang("Comic Gardo", "https://comic-gardo.com", "ja"),
SingleLang("Comiplex", "https://viewer.heros-web.com", "ja"),
SingleLang("Corocoro Online", "https://corocoro.jp", "ja"),
SingleLang("Kurage Bunch", "https://kuragebunch.com", "ja"),
SingleLang("MAGCOMI", "https://magcomi.com", "ja", className = "MagComi"),
SingleLang("Magazine Pocket", "https://pocket.shonenmagazine.com", "ja"),