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:
parent
76bd3bb892
commit
1fc3a46632
|
@ -2,8 +2,12 @@ ext {
|
||||||
extName = 'Manga Crab'
|
extName = 'Manga Crab'
|
||||||
extClass = '.MangaCrab'
|
extClass = '.MangaCrab'
|
||||||
themePkg = 'madara'
|
themePkg = 'madara'
|
||||||
baseUrl = 'https://mangacrab3.com'
|
baseUrl = 'https://httpmangacrab2.com'
|
||||||
overrideVersionCode = 7
|
overrideVersionCode = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(':lib:randomua'))
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +1,37 @@
|
||||||
package eu.kanade.tachiyomi.extension.es.mangacrab
|
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.multisrc.madara.Madara
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
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.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class MangaCrab : Madara(
|
class MangaCrab :
|
||||||
|
Madara(
|
||||||
"Manga Crab",
|
"Manga Crab",
|
||||||
"https://mangacrab3.com",
|
"https://httpmangacrab2.com",
|
||||||
"es",
|
"es",
|
||||||
SimpleDateFormat("dd/MM/yyyy", Locale("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()
|
override val client = super.client.newBuilder()
|
||||||
|
.setRandomUserAgent(
|
||||||
|
preferences.getPrefUAType(),
|
||||||
|
preferences.getPrefCustomUA(),
|
||||||
|
)
|
||||||
.rateLimit(1, 2)
|
.rateLimit(1, 2)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
@ -19,4 +39,8 @@ class MangaCrab : Madara(
|
||||||
|
|
||||||
override fun chapterListSelector() = "div.listing-chapters_wrap > ul > li"
|
override fun chapterListSelector() = "div.listing-chapters_wrap > ul > li"
|
||||||
override val mangaDetailsSelectorDescription = "div.c-page__content div.modal-contenido"
|
override val mangaDetailsSelectorDescription = "div.c-page__content div.modal-contenido"
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
addRandomUAPreferenceToScreen(screen)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue