MangasProject split (#6455)
* Create MangasProject.kt * Create MangasProjectGenerator.kt * Added Override and icons * Deleted pre split files * Update MangaLivre.kt * Update Toonei.kt * Update LeitorNet.kt * Update MangasProject.kt * Update LeitorNet.kt * Update MangaLivre.kt * Update Toonei.kt
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
52
multisrc/overrides/mangasproject/leitornet/src/LeitorNet.kt
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package eu.kanade.tachiyomi.extension.pt.leitornet
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.multisrc.mangasproject.MangasProject
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
|
|
||||||
|
class LeitorNet : MangasProject("Leitor.net", "https://leitor.net", "pt-br") {
|
||||||
|
|
||||||
|
// Use the old generated id when the source did have the name "mangásPROJECT" and
|
||||||
|
// did have mangas in their catalogue. Now they "only have webtoons" and
|
||||||
|
// became a different website, but they still use the same structure.
|
||||||
|
// Existing mangas and other titles in the library still work.
|
||||||
|
override val id: Long = 2225174659569980836
|
||||||
|
|
||||||
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
|
.addInterceptor(RateLimitInterceptor(5, 1, TimeUnit.SECONDS))
|
||||||
|
.connectTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.readTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.writeTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary fix to bypass Cloudflare.
|
||||||
|
*/
|
||||||
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
|
val newHeaders = super.pageListRequest(chapter).headers().newBuilder()
|
||||||
|
.set("Referer", "https://mangalivre.net/home")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val newChapterUrl = chapter.url
|
||||||
|
.replace("/manga/", "/ler/")
|
||||||
|
.replace("/(\\d+)/capitulo-".toRegex(), "/online/$1/capitulo-")
|
||||||
|
|
||||||
|
return GET("https://mangalivre.net$newChapterUrl", newHeaders)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getChapterUrl(response: Response): String {
|
||||||
|
return super.getChapterUrl(response)
|
||||||
|
.replace("https://mangalivre.net", baseUrl)
|
||||||
|
.replace("/ler/", "/manga/")
|
||||||
|
.replace("/online/", "/")
|
||||||
|
}
|
||||||
|
}
|
@ -1,59 +1,31 @@
|
|||||||
package eu.kanade.tachiyomi.extension.pt.mangasproject
|
package eu.kanade.tachiyomi.extension.pt.mangalivre
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.annotations.Nsfw
|
import eu.kanade.tachiyomi.multisrc.mangasproject.MangasProject
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.Source
|
|
||||||
import eu.kanade.tachiyomi.source.SourceFactory
|
|
||||||
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
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
|
|
||||||
@Nsfw
|
class MangaLivre : MangasProject("Mangá Livre", "https://mangalivre.net", "pt-br") {
|
||||||
class MangasProjectFactory : SourceFactory {
|
|
||||||
override fun createSources(): List<Source> = listOf(
|
|
||||||
LeitorNet(),
|
|
||||||
MangaLivre(),
|
|
||||||
Toonei()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
class LeitorNet : MangasProject("Leitor.net", "https://leitor.net") {
|
|
||||||
// Use the old generated id when the source did have the name "mangásPROJECT" and
|
|
||||||
// did have mangas in their catalogue. Now they "only have webtoons" and
|
|
||||||
// became a different website, but they still use the same structure.
|
|
||||||
// Existing mangas and other titles in the library still work.
|
|
||||||
override val id: Long = 2225174659569980836
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporary fix to bypass Cloudflare.
|
|
||||||
*/
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
|
||||||
val newHeaders = super.pageListRequest(chapter).headers().newBuilder()
|
|
||||||
.set("Referer", "https://mangalivre.net/home")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
val newChapterUrl = chapter.url
|
|
||||||
.replace("/manga/", "/ler/")
|
|
||||||
.replace("/(\\d+)/capitulo-".toRegex(), "/online/$1/capitulo-")
|
|
||||||
|
|
||||||
return GET("https://mangalivre.net$newChapterUrl", newHeaders)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getChapterUrl(response: Response): String {
|
|
||||||
return super.getChapterUrl(response)
|
|
||||||
.replace("https://mangalivre.net", baseUrl)
|
|
||||||
.replace("/ler/", "/manga/")
|
|
||||||
.replace("/online/", "/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MangaLivre : MangasProject("Mangá Livre", "https://mangalivre.net") {
|
|
||||||
// Hardcode the id because the language wasn't specific.
|
// Hardcode the id because the language wasn't specific.
|
||||||
override val id: Long = 4762777556012432014
|
override val id: Long = 4762777556012432014
|
||||||
|
|
||||||
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
|
.addInterceptor(RateLimitInterceptor(5, 1, TimeUnit.SECONDS))
|
||||||
|
.connectTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.readTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.writeTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.build()
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
val originalRequestUrl = super.popularMangaRequest(page).url().toString()
|
val originalRequestUrl = super.popularMangaRequest(page).url().toString()
|
||||||
@ -109,13 +81,3 @@ class MangaLivre : MangasProject("Mangá Livre", "https://mangalivre.net") {
|
|||||||
private const val DEFAULT_TYPE = "manga"
|
private const val DEFAULT_TYPE = "manga"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Toonei : MangasProject("Toonei", "https://toonei.com") {
|
|
||||||
|
|
||||||
override fun getReaderToken(document: Document): String? {
|
|
||||||
return document.select("script:containsData(window.PAGES_KEY)").firstOrNull()
|
|
||||||
?.data()
|
|
||||||
?.substringAfter("\"")
|
|
||||||
?.substringBefore("\";")
|
|
||||||
}
|
|
||||||
}
|
|
29
multisrc/overrides/mangasproject/toonei/src/Toonei.kt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package eu.kanade.tachiyomi.extension.pt.toonei
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.multisrc.mangasproject.MangasProject
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
|
|
||||||
|
class Toonei : MangasProject("Toonei", "https://toonei.com", "pt-br") {
|
||||||
|
|
||||||
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
|
.addInterceptor(RateLimitInterceptor(5, 1, TimeUnit.SECONDS))
|
||||||
|
.connectTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.readTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.writeTimeout(1, TimeUnit.MINUTES)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
override fun getReaderToken(document: Document): String? {
|
||||||
|
return document.select("script:containsData(window.PAGES_KEY)").firstOrNull()
|
||||||
|
?.data()
|
||||||
|
?.substringAfter("\"")
|
||||||
|
?.substringBefore("\";")
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,10 @@
|
|||||||
package eu.kanade.tachiyomi.extension.pt.mangasproject
|
package eu.kanade.tachiyomi.multisrc.mangasproject
|
||||||
|
|
||||||
import com.github.salomonbrys.kotson.array
|
import com.github.salomonbrys.kotson.array
|
||||||
import com.github.salomonbrys.kotson.obj
|
import com.github.salomonbrys.kotson.obj
|
||||||
import com.github.salomonbrys.kotson.string
|
import com.github.salomonbrys.kotson.string
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.google.gson.JsonParser
|
import com.google.gson.JsonParser
|
||||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
@ -31,16 +30,16 @@ import java.util.concurrent.TimeUnit
|
|||||||
|
|
||||||
abstract class MangasProject(
|
abstract class MangasProject(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
override val baseUrl: String
|
override val baseUrl: String,
|
||||||
|
override val lang: String
|
||||||
) : HttpSource() {
|
) : HttpSource() {
|
||||||
|
|
||||||
override val lang = "pt-BR"
|
|
||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
// Sometimes the site is slow.
|
// Sometimes the site is slow.
|
||||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
.addInterceptor(RateLimitInterceptor(5, 1, TimeUnit.SECONDS))
|
//.addInterceptor(RateLimitInterceptor(5, 1, TimeUnit.SECONDS))
|
||||||
.connectTimeout(1, TimeUnit.MINUTES)
|
.connectTimeout(1, TimeUnit.MINUTES)
|
||||||
.readTimeout(1, TimeUnit.MINUTES)
|
.readTimeout(1, TimeUnit.MINUTES)
|
||||||
.writeTimeout(1, TimeUnit.MINUTES)
|
.writeTimeout(1, TimeUnit.MINUTES)
|
||||||
@ -279,7 +278,7 @@ abstract class MangasProject(
|
|||||||
.mapIndexed { i, obj -> Page(i, chapterUrl, obj.string) }
|
.mapIndexed { i, obj -> Page(i, chapterUrl, obj.string) }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun getChapterUrl(response: Response): String {
|
open fun getChapterUrl(response: Response): String {
|
||||||
return response.request().url().toString()
|
return response.request().url().toString()
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
package eu.kanade.tachiyomi.multisrc.mangasproject
|
||||||
|
|
||||||
|
import generator.ThemeSourceData.SingleLang
|
||||||
|
import generator.ThemeSourceGenerator
|
||||||
|
|
||||||
|
class MangasProjectGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
|
override val themePkg = "mangasproject"
|
||||||
|
|
||||||
|
override val themeClass = "MangasProject"
|
||||||
|
|
||||||
|
override val baseVersionCode: Int = 1
|
||||||
|
|
||||||
|
override val sources = listOf(
|
||||||
|
SingleLang("Leitor.net", "https://leitor.net", "pt-br", className = "LeitorNet"),
|
||||||
|
SingleLang("Mangá Livre", "https://mangalivre.net", "pt-br", className = "MangaLivre", isNsfw = true),
|
||||||
|
SingleLang("Toonei", "https://toonei.com", "pt-br"),
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
MangasProjectGenerator().createAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest package="eu.kanade.tachiyomi.extension" />
|
|
@ -1,17 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
extName = 'mangásPROJECT'
|
|
||||||
pkgNameSuffix = 'pt.mangasproject'
|
|
||||||
extClass = '.MangasProjectFactory'
|
|
||||||
extVersionCode = 18
|
|
||||||
libVersion = '1.2'
|
|
||||||
containsNsfw = true
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(':lib-ratelimit')
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
|