Created a standalone extension for TCBScans due to layout changes (#8426)

* Created a standalone extension for TCBScans due to layout changes

* Updated TCBScans version code
This commit is contained in:
fabiomurru96 2021-08-09 12:58:41 +02:00 committed by GitHub
parent ab8ea9ddb5
commit 4afb9dea21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 121 additions and 1 deletions

View File

@ -22,7 +22,6 @@ class MangaMainacGenerator : ThemeSourceGenerator {
SingleLang("Read Kaguya-sama: Love is War", "https://kaguyasama.net/", "en", className = "ReadKaguyaSamaLoveIsWar", pkgName = "readkaguyasamaloveiswar"),
SingleLang("Read Domestic Girlfriend Manga", "https://domesticgirlfriend.net/", "en"),
SingleLang("Read Black Clover Manga", "https://w1.blackclovermanga2.com/", "en"),
SingleLang("TCB Scans", "https://onepiecechapters.com/", "en", overrideVersionCode = 2),
SingleLang("Read Shingeki no Kyojin Manga", "https://readshingekinokyojin.com/", "en"),
SingleLang("Read Nanatsu no Taizai Manga", "https://w1.readnanatsutaizai.net/", "en"),
SingleLang("Read Rent a Girlfriend Manga", "https://kanojo-okarishimasu.com/", "en"),

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" />

View File

@ -0,0 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'TCB Scans'
pkgNameSuffix = 'en.tcbscans'
extClass = '.TCBScans'
extVersionCode = 4
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,107 @@
package eu.kanade.tachiyomi.extension.en.tcbscans
import eu.kanade.tachiyomi.network.GET
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.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
class TCBScans : ParsedHttpSource() {
override val name = "TCB Scans"
override val baseUrl = "https://onepiecechapters.com"
override val lang = "en"
override val supportsLatest = false
override val client: OkHttpClient = network.cloudflareClient
// popular
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/projects")
}
override fun popularMangaSelector() = "#latestProjects .elementor-widget-image-box:not(.elementor-widget-spacer)"
override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create()
manga.thumbnail_url = element.select(".attachment-thumbnail").attr("src")
manga.setUrlWithoutDomain(element.select(".elementor-image-box-title a").attr("href"))
manga.title = element.select(".elementor-image-box-title a").text()
return manga
}
override fun popularMangaNextPageSelector(): String? = null
// latest
override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException()
override fun latestUpdatesSelector(): String = throw UnsupportedOperationException()
override fun latestUpdatesFromElement(element: Element): SManga = throw UnsupportedOperationException()
override fun latestUpdatesNextPageSelector(): String? = throw UnsupportedOperationException()
// search
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> = Observable.just(MangasPage(emptyList(), false))
override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not used")
override fun searchMangaNextPageSelector(): String? = throw Exception("Not used")
override fun searchMangaSelector(): String = throw Exception("Not used")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used")
// manga details
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
val descElement = document.select(".elementor-widget-text-editor").parents().first()
thumbnail_url = descElement.select("img").attr("src")
title = descElement.select(".elementor-heading-title").text()
description = descElement.select(".elementor-widget-text-editor div").text()
}
// chapters
override fun chapterListSelector() = ".elementor-column-gap-no .elementor-widget-image-box,.elementor-column-gap-default .elementor-widget-image-box"
override fun chapterFromElement(element: Element): SChapter {
val urlElement = element.select("a").first()
val chapter = SChapter.create()
chapter.setUrlWithoutDomain(urlElement.attr("href"))
chapter.name = element.select(".elementor-image-box-title").text() + ": " + element.select(".elementor-image-box-description").text()
return chapter
}
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val chapterList = document.select(chapterListSelector()).map { chapterFromElement(it) }
return chapterList
}
// pages
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
var i = 0
document.select(".container .img_container center img").forEach { element ->
val url = element.attr("src")
i++
if (url.isNotEmpty()) {
pages.add(Page(i, "", url))
}
}
return pages
}
override fun imageUrlParse(document: Document) = ""
}