Manga Crab: Add randomUa and change domain (#1539)

* Add randomUa and change domain

* Lint

* Lint?

* Remove lazy

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>

---------

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
bapeey 2024-02-26 09:18:46 -05:00 committed by Draff
parent 76bd3bb892
commit 1fc3a46632
2 changed files with 36 additions and 8 deletions

View File

@ -2,8 +2,12 @@ ext {
extName = 'Manga Crab'
extClass = '.MangaCrab'
themePkg = 'madara'
baseUrl = 'https://mangacrab3.com'
overrideVersionCode = 7
baseUrl = 'https://httpmangacrab2.com'
overrideVersionCode = 8
}
apply from: "$rootDir/common.gradle"
dependencies {
implementation(project(':lib:randomua'))
}

View File

@ -1,17 +1,37 @@
package eu.kanade.tachiyomi.extension.es.mangacrab
import android.app.Application
import android.content.SharedPreferences
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.lib.randomua.addRandomUAPreferenceToScreen
import eu.kanade.tachiyomi.lib.randomua.getPrefCustomUA
import eu.kanade.tachiyomi.lib.randomua.getPrefUAType
import eu.kanade.tachiyomi.lib.randomua.setRandomUserAgent
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.ConfigurableSource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.text.SimpleDateFormat
import java.util.Locale
class MangaCrab : Madara(
class MangaCrab :
Madara(
"Manga Crab",
"https://mangacrab3.com",
"https://httpmangacrab2.com",
"es",
SimpleDateFormat("dd/MM/yyyy", Locale("es")),
) {
),
ConfigurableSource {
private val preferences: SharedPreferences =
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
override val client = super.client.newBuilder()
.setRandomUserAgent(
preferences.getPrefUAType(),
preferences.getPrefCustomUA(),
)
.rateLimit(1, 2)
.build()
@ -19,4 +39,8 @@ class MangaCrab : Madara(
override fun chapterListSelector() = "div.listing-chapters_wrap > ul > li"
override val mangaDetailsSelectorDescription = "div.c-page__content div.modal-contenido"
override fun setupPreferenceScreen(screen: PreferenceScreen) {
addRandomUAPreferenceToScreen(screen)
}
}