Remove BR Mangás due to arbitrary chapter domains (#19230)
Remove BR Mangás due to arbitrary chapter domains.
This commit is contained in:
parent
3eb7ad4409
commit
8dd1a65501
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest />
|
|
|
@ -1,12 +0,0 @@
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
extName = 'BR Mangás'
|
|
||||||
pkgNameSuffix = 'pt.brmangas'
|
|
||||||
extClass = '.BrMangas'
|
|
||||||
extVersionCode = 5
|
|
||||||
isNsfw = true
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 53 KiB |
|
@ -1,146 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.extension.pt.brmangas
|
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
|
||||||
import okhttp3.Headers
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.Request
|
|
||||||
import okhttp3.Response
|
|
||||||
import org.jsoup.nodes.Document
|
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
class BrMangas : ParsedHttpSource() {
|
|
||||||
|
|
||||||
override val name = "BR Mangás"
|
|
||||||
|
|
||||||
override val baseUrl = "https://www.brmangas.net"
|
|
||||||
|
|
||||||
override val lang = "pt-BR"
|
|
||||||
|
|
||||||
override val supportsLatest = true
|
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
|
||||||
.rateLimit(1, 2, TimeUnit.SECONDS)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
|
||||||
.add("Accept", ACCEPT)
|
|
||||||
.add("Accept-Language", ACCEPT_LANGUAGE)
|
|
||||||
.add("Referer", "$baseUrl/")
|
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
|
||||||
val listPath = if (page == 1) "" else "page/${page - 1}"
|
|
||||||
val newHeaders = headersBuilder()
|
|
||||||
.set("Referer", "$baseUrl/$listPath")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
val pageStr = if (page != 1) "page/$page" else ""
|
|
||||||
return GET("$baseUrl/$pageStr", newHeaders)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun popularMangaSelector(): String =
|
|
||||||
"span.heading:contains(Todos os Mangás) ~ div.listagem.row div.item a[title]"
|
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
|
|
||||||
val thumbnailEl = element.select("img").first()!!
|
|
||||||
|
|
||||||
title = element.select("h2.titulo").first()!!.text()
|
|
||||||
thumbnail_url = when {
|
|
||||||
thumbnailEl.hasAttr("original-src") -> thumbnailEl.attr("original-src")
|
|
||||||
else -> thumbnailEl.attr("src")
|
|
||||||
}
|
|
||||||
setUrlWithoutDomain(element.attr("href"))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun popularMangaNextPageSelector() = "div.navigation a.next"
|
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int): Request {
|
|
||||||
val listPath = if (page == 1) "" else "category/page/${page - 1}"
|
|
||||||
val newHeaders = headersBuilder()
|
|
||||||
.set("Referer", "$baseUrl/$listPath")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
val pageStr = if (page != 1) "page/$page" else ""
|
|
||||||
return GET("$baseUrl/category/mangas/$pageStr", newHeaders)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun latestUpdatesSelector() = popularMangaSelector()
|
|
||||||
|
|
||||||
override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element)
|
|
||||||
|
|
||||||
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
|
||||||
val url = baseUrl.toHttpUrl().newBuilder()
|
|
||||||
.addQueryParameter("s", query)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
return GET(url, headers)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun searchMangaSelector() = "div.listagem.row div.item a[title]"
|
|
||||||
|
|
||||||
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
|
|
||||||
|
|
||||||
override fun searchMangaNextPageSelector(): String? = null
|
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
|
||||||
val infoElement = document.select("div.serie-geral div.infoall").first()!!
|
|
||||||
|
|
||||||
title = document.select("title").first()!!.text().substringBeforeLast(" - ")
|
|
||||||
author = infoElement.select("div.serie-infos li:contains(Autor)").firstOrNull()?.ownText()
|
|
||||||
genre = infoElement.select("a.category.tag").joinToString { it.text() }
|
|
||||||
description = document.select("div.manga_sinopse ~ p").text().trim()
|
|
||||||
thumbnail_url = infoElement.select("div.serie-capa img").first()!!.attr("src")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
|
||||||
return super.chapterListParse(response).reversed()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun chapterListSelector() = "ul.capitulos li.row a"
|
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
|
|
||||||
name = element.text()
|
|
||||||
setUrlWithoutDomain(element.attr("href"))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
|
||||||
return document.select("script:containsData(imageArray)").first()!!
|
|
||||||
.data()
|
|
||||||
.substringAfter("[")
|
|
||||||
.substringBefore("]")
|
|
||||||
.split(",")
|
|
||||||
.mapIndexed { i, imageUrl ->
|
|
||||||
val fixedImageUrl = imageUrl
|
|
||||||
.replace("\\\"", "")
|
|
||||||
.replace("\\/", "/")
|
|
||||||
Page(i, document.location(), fixedImageUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = ""
|
|
||||||
|
|
||||||
override fun imageRequest(page: Page): Request {
|
|
||||||
val newHeaders = headersBuilder()
|
|
||||||
.set("Accept", ACCEPT_IMAGE)
|
|
||||||
.set("Referer", page.url)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
return GET(page.imageUrl!!, newHeaders)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9," +
|
|
||||||
"image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
|
|
||||||
private const val ACCEPT_IMAGE = "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
|
|
||||||
private const val ACCEPT_LANGUAGE = "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,gl;q=0.5"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue