Skip to content
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

[ru-Acomics] Fix parsing popular and search page #6611

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ru/acomics/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'AComics'
extClass = '.AComics'
extVersionCode = 4
extVersionCode = 5
isNsfw = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.ru.acomics
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Filter
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
Expand Down Expand Up @@ -39,17 +40,32 @@ class AComics : ParsedHttpSource() {
override fun popularMangaRequest(page: Int): Request =
GET("$baseUrl/comics?$DEFAULT_COMIC_QUERIES&sort=subscr_count&skip=${10 * (page - 1)}", headers)

override fun popularMangaSelector() = "table.list-loadable > tbody > tr"
override fun popularMangaSelector() = "section.serial-card"

override fun popularMangaFromElement(element: Element) = SManga.create().apply {
thumbnail_url = element.selectFirst("a > img")?.absUrl("src")
element.selectFirst("div.title > a")!!.run {
thumbnail_url = element.selectFirst("a > img")?.absUrl("data-real-src")
element.selectFirst("h2 > a")!!.run {
setUrlWithoutDomain(attr("href") + "/about")
title = text()
}
}

override fun popularMangaNextPageSelector() = "span.button:not(:has(a)) + span.button > a"
override fun popularMangaNextPageSelector(): String? {
TODO("Not yet implemented")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are looking for a.infinite-scroll after the last div.infinite-scroll-content > section.serial-card. That element only exists if there is more content to load. You can make it as advanced or basic as you want.

}
Comment on lines +53 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either throw UnsupportedOperationException on set to empty string


override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup()

val mangas = document.select(popularMangaSelector()).map { element ->
popularMangaFromElement(element)
}

return MangasPage(mangas, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there not some end page? maybe check number of entries on page and end page would have less.

}

override fun latestUpdatesParse(response: Response) = popularMangaParse(response)
override fun searchMangaParse(response: Response) = popularMangaParse(response)

// =============================== Latest ===============================
override fun latestUpdatesRequest(page: Int): Request =
Expand All @@ -58,7 +74,6 @@ class AComics : ParsedHttpSource() {
override fun latestUpdatesSelector() = popularMangaSelector()

override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)

override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()

// =============================== Search ===============================
Expand Down
Loading