New Source: One Piece Berwarna (#18747)

* New Source: One Piece Berwarna

* Filter attr by css selector

* Hardcode author & artist name

Co-Authored-By: Luqman <16263232+Riztard@users.noreply.github.com>

* Fix reversed chapter list

* Filter ads with css selector

Co-Authored-By: Luqman <16263232+Riztard@users.noreply.github.com>

* hardcode manga details

* Use the proper methods for chapter parsing

Co-Authored-By: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>

---------

Co-authored-by: Riztard Lanthorn <riyanluqman@gmail.com>
Co-authored-by: Luqman <16263232+Riztard@users.noreply.github.com>
Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
This commit is contained in:
Muhammad Brian Abdillah 2023-10-29 06:28:56 +07:00 committed by GitHub
parent a052d7f471
commit 3f57ef8e98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 140 additions and 0 deletions

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -0,0 +1,11 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'One Piece Berwarna'
pkgNameSuffix = 'id.onepieceberwarna'
extClass = '.OnePieceBerwarna'
extVersionCode = 1
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -0,0 +1,127 @@
package eu.kanade.tachiyomi.extension.id.onepieceberwarna
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.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class OnePieceBerwarna : ParsedHttpSource() {
override val name = "One Piece Berwarna"
override val baseUrl = "https://onepieceberwarna.com"
override val lang = "id"
override val supportsLatest = false
// one page contains all chapters
override fun popularMangaRequest(page: Int): Request = GET(baseUrl, headers)
override fun popularMangaSelector() = "section[data-id]:not(:first-child)"
override fun popularMangaParse(response: Response): MangasPage {
val mainElements = response.asJsoup()
val list = mutableListOf<SManga>()
var saga: String? = null
var volume: String? = null
val sections = mainElements.select(popularMangaSelector())
run loop@{
sections.forEach { element ->
val dataID = element.attr("data-id")
if (dataID == "49afe94") {
// break on non-manga section
return@loop
}
element.select(".elementor-col-100:not(:has(div[data-element_type=icon.default])) h1")
.first()?.let {
saga = it.text()
}
element.select(".elementor-col-50 h1").first()?.let {
volume = it.text()
}
element.select(".elementor-widget-container > img[data-src]").first()?.let {
list.add(
SManga.create().apply {
title = "$saga $volume"
thumbnail_url = it.attr("data-src")
url = dataID // just for identifier
},
)
}
}
}
return MangasPage(list, false)
}
override fun popularMangaFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used")
override fun popularMangaNextPageSelector() = throw UnsupportedOperationException("Not used")
override fun mangaDetailsRequest(manga: SManga) = GET(baseUrl, headers)
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
author = "Eiichiro Oda"
description = "Bercerita tentang seorang laki-laki bernama Monkey D. Luffy, yang menentang arti dari gelar bajak laut. Daripada kesan nama besar, kejahatan, kekerasan, dia lebih terlihat seperti bajak laut rendahan yang suka bersenang-senang, alasan Luffy menjadi bajak laut adalah tekadnya untuk berpetualang di lautan yang menyenangkan dan bertemu orang-orang baru dan menarik, serta bersama-sama mencari One Piece."
genre = "Action, Adventure, Comedy, Fantasy, Martial Arts, Mystery, Shounen, Supernatural"
}
override fun chapterListSelector(): String = "section[data-id=%s] .elementor-text-editor strong > a"
override fun chapterListRequest(manga: SManga) = GET("$baseUrl/#${manga.url}", headers)
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val dataId = response.request.url.fragment!!
val selector = chapterListSelector().format(dataId)
return document.select(selector)
.map(::chapterFromElement)
.reversed()
}
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
name = element.text()
setUrlWithoutDomain(element.attr("href"))
}
override fun pageListParse(document: Document): List<Page> {
return document.select(".entry-content img[data-src]:not(a img)")
.mapIndexed { index, img ->
Page(index, "", img.attr("data-src"))
}
}
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
override fun latestUpdatesFromElement(element: Element) = throw UnsupportedOperationException("Not used")
override fun latestUpdatesNextPageSelector() = throw UnsupportedOperationException("Not used")
override fun latestUpdatesRequest(page: Int) = throw UnsupportedOperationException("Not used")
override fun latestUpdatesSelector() = throw UnsupportedOperationException("Not used")
// website doesn't have search
override fun searchMangaFromElement(element: Element) = throw UnsupportedOperationException("Not used")
override fun searchMangaNextPageSelector() = throw UnsupportedOperationException("Not used")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = throw UnsupportedOperationException("Not used")
override fun searchMangaSelector() = throw UnsupportedOperationException("Not used")
}