Skip to content

Commit

Permalink
Add hunters scans (#355)
Browse files Browse the repository at this point in the history
* Add hunters scans

* reorder imports

* reorder more imports...
  • Loading branch information
NotBlankyu authored and cuong-tran committed Jan 19, 2024
1 parent b9c5df4 commit 3273811
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions multisrc/overrides/madara/huntersscans/src/HuntersScans.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package eu.kanade.tachiyomi.extension.pt.huntersscans

import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.FormBody
import okhttp3.OkHttpClient
import okhttp3.Request
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit

class HuntersScans : Madara(
"Hunters Scan",
"https://huntersscan.xyz/",
"pt-BR",
SimpleDateFormat("dd 'de' MMMMM 'de' yyyy", Locale("pt", "BR")),
) {

override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()

override val useNewChapterEndpoint = true

private fun loadMoreRequest(page: Int, metaKey: String): Request {
val formBody = FormBody.Builder().apply {
add("action", "madara_load_more")
add("page", page.toString())
add("template", "madara-core/content/content-archive")
add("vars[paged]", "1")
add("vars[orderby]", "meta_value_num")
add("vars[template]", "archive")
add("vars[sidebar]", "right")
add("vars[post_type]", "wp-manga")
add("vars[post_status]", "publish")
add("vars[meta_key]", metaKey)
add("vars[order]", "desc")
add("vars[meta_query][relation]", "AND")
add("vars[manga_archives_item_layout]", "default")
}.build()

val xhrHeaders = headersBuilder()
.add("Content-Length", formBody.contentLength().toString())
.add("Content-Type", formBody.contentType().toString())
.add("X-Requested-With", "XMLHttpRequest")
.build()

return POST("$baseUrl/wp-admin/admin-ajax.php", xhrHeaders, formBody)
}

override fun popularMangaRequest(page: Int): Request {
return loadMoreRequest(page - 1, "_wp_manga_views")
}

override fun latestUpdatesRequest(page: Int): Request {
return loadMoreRequest(page - 1, "_latest_update")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("hManhwa", "https://hmanhwa.com", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("HouseMangas", "https://housemangas.com", "es"),
SingleLang("Hreads", "https://hreads.net", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("Hunters Scans", "https://huntersscan.xyz", "pt-BR", isNsfw = true),
SingleLang("I Love Manhwa", "https://ilovemanhwa.com", "en", isNsfw = true),
SingleLang("Illusion Scan", "https://illusionscan.com", "pt-BR", isNsfw = true),
SingleLang("Immortal Updates", "https://immortalupdates.com", "en", overrideVersionCode = 6),
Expand Down

0 comments on commit 3273811

Please sign in to comment.