Skip to content

Commit

Permalink
Update domains (#6521)
Browse files Browse the repository at this point in the history
* Update domains

* Update domain and enable genre filters
  • Loading branch information
choppeh authored Dec 7, 2024
1 parent b856b9c commit a88ad07
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/id/birdtoon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext {
extName = 'BirdToon'
extClass = '.BirdToon'
themePkg = 'madara'
baseUrl = 'https://birdtoon.net'
overrideVersionCode = 0
baseUrl = 'https://birdtoon.org'
overrideVersionCode = 1
isNsfw = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package eu.kanade.tachiyomi.extension.id.birdtoon

import eu.kanade.tachiyomi.multisrc.madara.Madara

class BirdToon : Madara("BirdToon", "https://birdtoon.net", "id") {
class BirdToon : Madara(
"BirdToon",
"https://birdtoon.org",
"id",
) {
override val mangaSubString = "komik"

override val useLoadMoreRequest = LoadMoreStrategy.Never
}
4 changes: 2 additions & 2 deletions src/id/klikmanga/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext {
extName = 'KlikManga'
extClass = '.KlikManga'
themePkg = 'madara'
baseUrl = 'https://klikmanga.id'
overrideVersionCode = 2
baseUrl = 'https://klikmanga.com'
overrideVersionCode = 3
}

apply from: "$rootDir/common.gradle"
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ import eu.kanade.tachiyomi.multisrc.madara.Madara
import java.text.SimpleDateFormat
import java.util.Locale

class KlikManga : Madara("KlikManga", "https://klikmanga.id", "id", SimpleDateFormat("MMMM dd, yyyy", Locale("id")))
class KlikManga : Madara(
"KlikManga",
"https://klikmanga.com",
"id",
SimpleDateFormat("MMMM dd, yyyy", Locale("id")),
) {
override val mangaSubString = "daftar-komik"

override val useLoadMoreRequest = LoadMoreStrategy.Always
}
2 changes: 1 addition & 1 deletion src/id/komikindoid/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'KomikIndoID'
extClass = '.KomikIndoID'
extVersionCode = 14
extVersionCode = 15
}

apply from: "$rootDir/common.gradle"
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import java.util.Locale

class KomikIndoID : ParsedHttpSource() {
override val name = "KomikIndoID"
override val baseUrl = "https://komikindo.lol"
override val baseUrl = "https://komikindo.pw"
override val lang = "id"
override val supportsLatest = true
override val client: OkHttpClient = network.cloudflareClient
Expand Down
4 changes: 2 additions & 2 deletions src/id/mgkomik/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext {
extName = 'MG Komik'
extClass = '.MGKomik'
themePkg = 'madara'
baseUrl = 'https://mgkomik.id'
overrideVersionCode = 14
baseUrl = 'https://mgkomik.org'
overrideVersionCode = 15
isNsfw = false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ package eu.kanade.tachiyomi.extension.id.mgkomik
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Request
import org.jsoup.nodes.Document
import java.text.SimpleDateFormat
import java.util.Locale

class MGKomik : Madara(
"MG Komik",
"https://mgkomik.id",
"https://mgkomik.org",
"id",
SimpleDateFormat("dd MMM yy", Locale.US),
) {
override val useLoadMoreRequest = LoadMoreStrategy.Never

override val useNewChapterEndpoint = false

override val mangaSubString = "komik"
Expand All @@ -38,9 +43,11 @@ class MGKomik : Madara(
.rateLimit(9, 2)
.build()

// ================================== Popular ======================================

override fun popularMangaNextPageSelector() = ".wp-pagenavi span.current + a"

override fun searchMangaNextPageSelector() = "a.page.larger"
// ================================== Latest =======================================

override fun latestUpdatesRequest(page: Int): Request =
if (useLoadMoreRequest()) {
Expand All @@ -49,8 +56,94 @@ class MGKomik : Madara(
GET("$baseUrl/$mangaSubString/${searchPage(page)}", headers)
}

// ================================== Search =======================================

override fun searchRequest(page: Int, query: String, filters: FilterList): Request {
filters.forEach { filter ->
when (filter) {
is GenreContentFilter -> {
val url = filter.toUriPart()
if (url.isBlank()) {
return@forEach
}
return GET(filter.toUriPart(), headers)
}
else -> {}
}
}
return super.searchRequest(page, query, filters)
}

override fun searchMangaSelector() = "${super.searchMangaSelector()}, .page-listing-item .page-item-detail"

override fun searchMangaNextPageSelector() = "a.page.larger"

// ================================ Chapters ================================

override val chapterUrlSuffix = ""

// ================================ Filters ================================

private var genresList: List<Genre> = emptyList()

override val fetchGenres = false

override fun getFilterList(): FilterList {
launchIO { fetchGenresOption() }

val filters = super.getFilterList().list.toMutableList()

if (genresList.isNotEmpty()) {
filters += listOf(
Filter.Separator(),
Filter.Header(intl["genre_filter_header"]),
GenreContentFilter(
title = intl["genre_filter_title"],
options = genresList.map { it.name to it.id },
),
)
} else if (fetchGenres) {
filters += listOf(
Filter.Separator(),
Filter.Header(intl["genre_missing_warning"]),
)
}

return FilterList(filters)
}

private class GenreContentFilter(title: String, options: List<Pair<String, String>>) : UriPartFilter(
title,
options.toTypedArray(),
)

override fun genresRequest() = GET("$baseUrl/$mangaSubString", headers)

private var fetchGenresAttempts: Int = 0

fun fetchGenresOption() {
if (fetchGenresAttempts < 3 && genresList.isEmpty()) {
try {
genresList = client.newCall(genresRequest()).execute()
.use { parseGenres(it.asJsoup()) }
} catch (_: Exception) {
} finally {
fetchGenresAttempts++
}
}
}

override fun parseGenres(document: Document): List<Genre> {
val genres = mutableListOf<Genre>()
genres += Genre("All", "")
genres += document.select(".row.genres li a").map { a ->
Genre(a.text(), a.absUrl("href"))
}
return genres
}

// =============================== Utilities ==============================

private fun randomString(length: Int): String {
val charPool = ('a'..'z') + ('A'..'Z') + ('.')
return List(length) { charPool.random() }.joinToString("")
Expand Down
4 changes: 2 additions & 2 deletions src/tr/mangawt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext {
extName = 'MangaWT'
extClass = '.MangaWT'
themePkg = 'madara'
baseUrl = 'https://mangawt.net'
overrideVersionCode = 2
baseUrl = 'https://mangawt.com'
overrideVersionCode = 3
}

apply from: "$rootDir/common.gradle"
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package eu.kanade.tachiyomi.extension.tr.mangawt

import eu.kanade.tachiyomi.multisrc.madara.Madara
import java.text.SimpleDateFormat
import java.util.Locale

class MangaWT : Madara(
"MangaWT",
"https://mangawt.net",
"https://mangawt.com",
"tr",
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("tr")),
) {
override val useNewChapterEndpoint = true

override val useLoadMoreRequest = LoadMoreStrategy.Always
}

0 comments on commit a88ad07

Please sign in to comment.