Skip to content

Commit

Permalink
quick fix for exh
Browse files Browse the repository at this point in the history
  • Loading branch information
az4521 committed Oct 26, 2024
1 parent d135a75 commit b84a2b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 11 additions & 3 deletions app/src/main/java/eu/kanade/tachiyomi/source/online/all/EHentai.kt
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,17 @@ class EHentai(

private fun parseChapterPage(response: Element) =
with(response) {
select(".gdtm a").map {
Pair(it.child(0).attr("alt").toInt(), it.attr("href"))
}.sortedBy(Pair<Int, String>::first).map { it.second }
// quick garbage fix to for new thumbs format that's only on exh but will definitely change
// so i'm going to just support both on both sites cuz i don't want to update this again
// TODO: remove .gdtm a when that gets removed from e-h
(
select(".gdtm a").map {
Pair(it.child(0).attr("alt").toInt(), it.attr("href"))
} +
select("#gdt a").map {
Pair(it.child(0).attr("title").removePrefix("Page ").substringBefore(":").toInt(), it.attr("href"))
}
).sortedBy(Pair<Int, String>::first).map { it.second }
}

private fun chapterPageCall(np: String): Observable<Response> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import exh.metadata.metadata.NHentaiSearchMetadata
import exh.metadata.metadata.NHentaiSearchMetadata.Companion.TAG_TYPE_DEFAULT
import exh.metadata.metadata.base.RaisedTag
import exh.util.urlImportFetchSearchManga
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
Expand All @@ -41,10 +40,6 @@ class NHentai(context: Context) : HttpSource(), LewdSource<NHentaiSearchMetadata

override val client: OkHttpClient = network.cloudflareClient.newBuilder().build()

override fun headersBuilder(): Headers.Builder =
super.headersBuilder()
.set("User-Agent", USER_AGENT)

override fun fetchPopularManga(page: Int): Observable<MangasPage> {
// TODO There is currently no way to get the most popular mangas
// TODO Instead, we delegate this to the latest updates thing to avoid confusing users with an empty screen
Expand Down Expand Up @@ -369,7 +364,5 @@ class NHentai(context: Context) : HttpSource(), LewdSource<NHentaiSearchMetadata
Pair("Japanese", " japanese"),
Pair("Chinese", " chinese")
)

private const val USER_AGENT = "Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+"
}
}

0 comments on commit b84a2b3

Please sign in to comment.