[BlogTruyen] Search pagination, narrower intent filters, latestUpdates to homepage (#15030)

* [BlogTruyen] Fix search pagination, move latestUpdates back to homepage

* fix: intent filter should not accept forum links

* just to be safe
This commit is contained in:
beerpsi 2023-01-19 21:26:13 +07:00 committed by GitHub
parent adb3d5833f
commit 4600453724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 24 deletions

View File

@ -12,8 +12,8 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="blogtruyen.vn" />
<data android:host="*.blogtruyen.vn" />
<data android:pathPattern="/..*"
<data android:host="m.blogtruyen.vn" />
<data android:pathPattern="/..*/..*"
android:scheme="https" />
</intent-filter>
</activity>

View File

@ -5,7 +5,7 @@ ext {
extName = 'BlogTruyen'
pkgNameSuffix = 'vi.blogtruyen'
extClass = '.BlogTruyen'
extVersionCode = 12
extVersionCode = 13
isNsfw = true
}

View File

@ -86,30 +86,17 @@ class BlogTruyen : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = ".paging:last-child:not(.current_page)"
override fun latestUpdatesRequest(page: Int): Request =
GET("$baseUrl/ajax/Search/AjaxLoadListManga?key=tatca&orderBy=5&p=$page", headers)
GET(baseUrl + if (page != 1) "/page-$page" else "", headers)
override fun latestUpdatesParse(response: Response): MangasPage {
val document = response.asJsoup()
override fun latestUpdatesSelector() = ".storyitem .fl-l"
val manga = document.select(latestUpdatesSelector()).map {
val tiptip = it.attr("data-tiptip")
latestUpdatesFromElement(it, document.getElementById(tiptip))
}
val hasNextPage = document.selectFirst(latestUpdatesNextPageSelector()) != null
return MangasPage(manga, hasNextPage)
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
title = element.select("a").attr("title")
thumbnail_url = element.select("img").attr("abs:src")
}
override fun latestUpdatesSelector() = popularMangaSelector()
private fun latestUpdatesFromElement(element: Element, tiptip: Element): SManga =
popularMangaFromElement(element, tiptip)
override fun latestUpdatesFromElement(element: Element): SManga =
throw UnsupportedOperationException("Not used")
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun latestUpdatesNextPageSelector() = "select.slcPaging option:last-child:not([selected])"
override fun fetchSearchManga(
page: Int,
@ -137,7 +124,7 @@ class BlogTruyen : ParsedHttpSource() {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/timkiem/nangcao/1".toHttpUrl().newBuilder().apply {
addQueryParameter("txt", query)
addQueryParameter("page", page.toString())
addQueryParameter("p", page.toString())
val genres = mutableListOf<Int>()
val genresEx = mutableListOf<Int>()