feat(multisrc/pt): Add Pobreflix (#1900)

This commit is contained in:
Claudemirovsky
2023-07-15 14:59:57 +00:00
committed by GitHub
parent b2540242d8
commit 03fcb98a2d
8 changed files with 86 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,39 @@
package eu.kanade.tachiyomi.animeextension.pt.pobreflix
import android.util.Base64
import eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors.PainelfxExtractor
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Response
class Pobreflix : DooPlay(
"pt-BR",
"Pobreflix",
"https://pobreflix.biz",
) {
// ============================== Popular ===============================
override fun popularAnimeSelector() = "div.featured div.poster"
// =============================== Latest ===============================
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/series/page/$page/", headers)
// ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> {
val doc = response.use { it.asJsoup() }
return doc.select("div.source-box > a").flatMap {
val data = it.attr("href").toHttpUrl().queryParameter("auth")
?.let { Base64.decode(it, Base64.DEFAULT) }
?.let(::String)
?: return@flatMap emptyList()
val url = data.replace("\\", "").substringAfter("url\":\"").substringBefore('"')
when {
url.contains("painelfx") ->
PainelfxExtractor(client).videosFromUrl(url, headers)
else -> emptyList()
}
}
}
}

View File

@ -0,0 +1,46 @@
package eu.kanade.tachiyomi.animeextension.pt.pobreflix.extractors
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
class PainelfxExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, headers: Headers): List<Video> {
val doc = client.newCall(GET(url)).execute().asJsoup()
val lang = when (url.substringAfterLast("/")) {
"leg" -> "Legendado"
else -> "Dublado"
}
return doc.select("div.panel-body > button").flatMap { elem ->
val form = FormBody.Builder()
.add("idS", elem.attr("idS"))
.build()
val host = url.toHttpUrl().host
val newHeaders = headers.newBuilder().set("Referer", "https://$host/").build()
val req = client.newCall(POST("https://$host/CallEpi", body = form)).execute()
val decoded = req.body.string().decodeHex().let(::String).replace("\\", "")
if (decoded.contains("video\"")) {
decoded.substringAfter("video").split("{").drop(1).map {
val videoUrl = it.substringAfter("file\":\"").substringBefore('"')
val quality = it.substringAfter("label\":\"").substringBefore('"')
Video(videoUrl, "$lang - $quality", videoUrl, newHeaders)
}
} else {
emptyList()
}
}
}
// Stolen from AnimixPlay(EN) / GogoCdnExtractor
private fun String.decodeHex(): ByteArray {
check(length % 2 == 0) { "Must have an even length" }
return chunked(2)
.map { it.toInt(16).toByte() }
.toByteArray()
}
}

View File

@ -25,6 +25,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
SingleLang("Multimovies", "https://multimovies.shop", "en", isNsfw = false, overrideVersionCode = 7),
SingleLang("pactedanime", "https://pactedanime.com", "en", isNsfw = false, className = "PactedAnime", overrideVersionCode = 4),
SingleLang("Pi Fansubs", "https://pifansubs.org", "pt-BR", isNsfw = true, overrideVersionCode = 16),
SingleLang("Pobreflix", "https://pobreflix.biz", "pt-BR", isNsfw = true),
SingleLang("UniqueStream", "https://uniquestream.net", "en", isNsfw = false, overrideVersionCode = 2),
)