Remove ZinMangaIO and Move theme to Individual Extension (#3520)

* Remove ZinMangaIO

* Move likemanga to individual extension

* Cleanup

* Remove breakline

* Add named parameter

* Undo removing headersBuilder
This commit is contained in:
Chopper 2024-06-14 04:25:19 -03:00 committed by Draff
parent c33fe52809
commit 434a03bd78
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
14 changed files with 93 additions and 54 deletions

View File

@ -1,5 +0,0 @@
plugins {
id("lib-multisrc")
}
baseVersionCode = 1

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name=".en.likemanga.LikeMangaUrlActivity"
android:excludeFromRecents="true"
android:exported="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="likemanga.io"
android:pathPattern="/..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -1,9 +1,7 @@
ext { ext {
extName = 'LikeManga' extName = 'LikeManga'
extClass = '.LikeMangaIO' extClass = '.LikeManga'
themePkg = 'likemanga' extVersionCode = 4
baseUrl = 'https://likemanga.io'
overrideVersionCode = 3
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,7 +1,9 @@
package eu.kanade.tachiyomi.multisrc.likemanga package eu.kanade.tachiyomi.extension.en.likemanga
import android.util.Base64 import android.util.Base64
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
@ -20,25 +22,29 @@ import okhttp3.Response
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import rx.Observable
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
abstract class LikeManga( class LikeManga : ParsedHttpSource() {
override val name: String, override val name = "LikeManga"
override val baseUrl: String,
override val lang: String, override val baseUrl = "https://likemanga.io"
) : ParsedHttpSource() {
override val lang = "en"
override val supportsLatest = true override val supportsLatest = true
override val client = network.cloudflareClient override val client = network.cloudflareClient.newBuilder()
.rateLimit(1, 2)
.build()
private val json: Json by injectLazy()
override fun headersBuilder() = super.headersBuilder() override fun headersBuilder() = super.headersBuilder()
.add("Referer", "$baseUrl/") .add("Referer", "$baseUrl/")
private val json: Json by injectLazy()
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request {
return searchMangaRequest(page, "", FilterList(SortFilter("top-manga"))) return searchMangaRequest(page, "", FilterList(SortFilter("top-manga")))
} }
@ -57,6 +63,19 @@ abstract class LikeManga(
override fun latestUpdatesSelector() = searchMangaSelector() override fun latestUpdatesSelector() = searchMangaSelector()
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector() override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
if (query.startsWith(URL_SEARCH_PREFIX)) {
val url = "$baseUrl/${query.substringAfter(URL_SEARCH_PREFIX)}"
return client.newCall(GET(url, headers)).asObservableSuccess().map { response ->
MangasPage(
mangas = listOf(mangaDetailsParse(response).apply { setUrlWithoutDomain(url) }),
hasNextPage = false,
)
}
}
return super.fetchSearchManga(page, query, filters)
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = baseUrl.toHttpUrl().newBuilder().apply { val url = baseUrl.toHttpUrl().newBuilder().apply {
addQueryParameter("act", "searchadvance") addQueryParameter("act", "searchadvance")
@ -240,12 +259,6 @@ abstract class LikeManga(
override fun chapterListSelector() = ".wp-manga-chapter" override fun chapterListSelector() = ".wp-manga-chapter"
private fun String?.parseDate(): Long {
return runCatching {
dateFormat.parse(this!!)!!.time
}.getOrDefault(0L)
}
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val element = document.selectFirst("div.reading input#next_img_token") val element = document.selectFirst("div.reading input#next_img_token")
@ -277,12 +290,14 @@ abstract class LikeManga(
} }
} }
private fun String?.parseDate(): Long =
try { dateFormat.parse(this!!)!!.time } catch (_: Exception) { 0L }
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException() override fun imageUrlParse(document: Document) = throw UnsupportedOperationException()
companion object { companion object {
val dateFormat by lazy { const val URL_SEARCH_PREFIX = "slug:"
SimpleDateFormat("MMMM dd, yyyy", Locale.ENGLISH) private val dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.ENGLISH)
}
private val chapterPageCountRegex = Regex("""load_list_chapter\((\d+)\)""") private val chapterPageCountRegex = Regex("""load_list_chapter\((\d+)\)""")
} }
} }

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.multisrc.likemanga package eu.kanade.tachiyomi.extension.en.likemanga
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter

View File

@ -1,10 +0,0 @@
package eu.kanade.tachiyomi.extension.en.likemanga
import eu.kanade.tachiyomi.multisrc.likemanga.LikeManga
import eu.kanade.tachiyomi.network.interceptor.rateLimit
class LikeMangaIO : LikeManga("LikeManga", "https://likemanga.io", "en") {
override val client = super.client.newBuilder()
.rateLimit(1, 2)
.build()
}

View File

@ -0,0 +1,35 @@
package eu.kanade.tachiyomi.extension.en.likemanga
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.util.Log
import kotlin.system.exitProcess
class LikeMangaUrlActivity : Activity() {
private val tag = javaClass.simpleName
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 0) {
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${LikeManga.URL_SEARCH_PREFIX}${pathSegments[0]}")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e(tag, e.toString())
}
} else {
Log.e(tag, "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}

View File

@ -1,9 +0,0 @@
ext {
extName = 'ZinManga.io'
extClass = '.ZinMangaIO'
themePkg = 'likemanga'
baseUrl = 'https://zinmanga.io'
overrideVersionCode = 34
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1,7 +0,0 @@
package eu.kanade.tachiyomi.extension.en.zinmanhwa
import eu.kanade.tachiyomi.multisrc.likemanga.LikeManga
class ZinMangaIO : LikeManga("ZinManga.io", "https://zinmanga.io", "en") {
override val versionId = 2
}