-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add KunMangaTo source #6192
base: main
Are you sure you want to change the base?
Add KunMangaTo source #6192
Conversation
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
src/en/kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaTo.kt
Outdated
Show resolved
Hide resolved
.../kunmangato/src/eu/kanade/tachiyomi/extension/en/kunmangato/KunMangaToChapterResourcesDto.kt
Outdated
Show resolved
Hide resolved
@bapeey Pushed fixes in a separate commit. Will squash and force push in this branch after code's approval, if you don't mind (maybe I don't even need to be that specific of my actions) |
All commits are squashed during the merge process, so don't worry about that |
val a = element.selectFirst("a.manga")!! | ||
return SManga.create().apply { | ||
title = a.text() | ||
url = a.attr("href").removePrefix(baseUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url = a.attr("href").removePrefix(baseUrl) | |
setUrlWithoutDomain(a.absUrl("href")) |
author = document.selectFirst("p.mb-1:nth-child(1)")!!.text().drop(9) | ||
description = document.getElementById("manga-description")!!.text() | ||
genre = | ||
document.select("a.manga-genre").joinToString(", ") { element -> element.text() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
", " is already the default join operation, so no need to specify
val chaptersDocument = | ||
Jsoup.parse("<div>" + document.selectFirst(chapterListSelector())!!.attr("value") + "</div>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Jsoup.parseBodyFragment
instead.
(won't need to add div tag manually i think)
|
||
override fun chapterFromElement(element: Element): SChapter { | ||
return SChapter.create().apply { | ||
url = element.getElementsByTag("a").first()!!.attr("href").removePrefix(baseUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setUrlWithoutDomain
here too
also use selectFirst
instead of calling first()
extName = 'KunMangaTo' | ||
extClass = '.KunMangaTo' | ||
extVersionCode = 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be marked as NSFW since they carry 'He Does a Body Good'.
document.select("a.manga-genre").joinToString(", ") { element -> element.text() } | ||
status = | ||
if (document.select(".text-success").size > 0) SManga.COMPLETED else SManga.ONGOING | ||
thumbnail_url = document.selectFirst("img.text-end")!!.attr("src") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thumbnail_url
should be optional.
genre = | ||
document.select("a.manga-genre").joinToString(", ") { element -> element.text() } | ||
status = | ||
if (document.select(".text-success").size > 0) SManga.COMPLETED else SManga.ONGOING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat flaky. Since it is so generic it will cause issues if the layout changes slightly. It would be preferable if it's SManga.UNKOWN
by default, and only set to either completed or ongoing if found.
The document is a bit difficult to navigate, but you can rely on Jsoup's selectors:
*:has(~ #manga-description) p span:contains(Status:) ~ span
return SChapter.create().apply { | ||
url = element.getElementsByTag("a").first()!!.attr("href").removePrefix(baseUrl) | ||
name = element.getElementsByTag("h3").first()!!.text() | ||
date_upload = element.selectFirst(".text-muted")!!.text().parseChapterDate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date_upload
should be optional.
val form = FormBody.Builder() | ||
.add( | ||
"chapterIdx", | ||
response.request.url.toString().substringBefore(".html").substringAfterLast("-"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract to variable. Consider using regex.
val document = response.asJsoup()
val chapterIdx = response.request.url.toString().substringBefore(".html").substringAfterLast("-")
val form = FormBody.Builder()
.add("chapterIdx", chapterIdx)
.build()
val chaptersRequest = POST(
// ...
Checklist:
extVersionCode
value inbuild.gradle
for individual extensionsoverrideVersionCode
orbaseVersionCode
as needed for all multisrc extensionsisNsfw = true
flag inbuild.gradle
when appropriateid
if a source's name or language were changedweb_hi_res_512.png
when adding a new extension