New Source (#16872)

* New Source: LunarScans

* correct name
This commit is contained in:
AwkwardPeak7 2023-06-26 21:35:46 +05:00 committed by GitHub
parent 750d06f90d
commit e7bf077794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 78 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,77 @@
package eu.kanade.tachiyomi.extension.en.lunarscans
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
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.source.model.Page
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import okhttp3.Request
import org.jsoup.nodes.Document
class LunarScans : MangaThemesia(
"Lunar Scans",
"https://lunarscan.org",
"en",
"/series",
) {
override val client = super.client.newBuilder()
.rateLimit(1)
.build()
override fun headersBuilder() = super.headersBuilder()
.add("Referer", "$baseUrl/")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return if (query.isEmpty()) {
super.searchMangaRequest(page, query, filters)
} else {
GET("$baseUrl/?s=$query&page=$page", headers)
}
}
override fun getFilterList(): FilterList {
val filters = mutableListOf<Filter<*>>(
Filter.Header("Note: Can't be used with text search!"),
Filter.Separator(),
StatusFilter(),
TypeFilter(),
OrderByFilter(),
Filter.Header("Genre exclusion is not available for all sources"),
GenreListFilter(getGenreList()),
)
if (hasProjectPage) {
filters.addAll(
mutableListOf<Filter<*>>(
Filter.Separator(),
Filter.Header("NOTE: Can't be used with other filter!"),
Filter.Header("$name Project List page"),
ProjectFilter(),
),
)
}
return FilterList(filters)
}
override fun pageListParse(document: Document): List<Page> {
val scriptContent = document.selectFirst("script:containsData(ts_reader)")?.data()
?: return super.pageListParse(document)
val jsonString = scriptContent.substringAfter("ts_reader.run(").substringBefore(");")
val tsReader = json.decodeFromString<TSReader>(jsonString)
val imageUrls = tsReader.sources.firstOrNull()?.images ?: return emptyList()
return imageUrls.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) }
}
@Serializable
data class TSReader(
val sources: List<ReaderImageSource>,
)
@Serializable
data class ReaderImageSource(
val source: String,
val images: List<String>,
)
}

View File

@ -61,6 +61,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Kuma Scans (Kuma Translation)", "https://kumascans.com", "en", className = "KumaScans", overrideVersionCode = 1),
SingleLang("Legacy Scans", "https://legacy-scans.com", "fr", pkgName = "flamescansfr"),
SingleLang("LianScans", "https://www.lianscans.my.id", "id", isNsfw = true),
SingleLang("Lunar Scans", "https://lunarscan.org", "en", isNsfw = true),
SingleLang("Magus Manga", "https://magusmanga.com", "ar"),
SingleLang("Manga Indo.me", "https://mangaindo.me", "id", className = "MangaIndoMe"),
SingleLang("Manga Raw.org", "https://mangaraw.org", "ja", className = "MangaRawOrg", overrideVersionCode = 1),