Initial commit
This commit is contained in:
commit
98ed7e8839
2263 changed files with 108711 additions and 0 deletions
14
src/pt/pifansubs/build.gradle
Normal file
14
src/pt/pifansubs/build.gradle
Normal file
|
@ -0,0 +1,14 @@
|
|||
ext {
|
||||
extName = 'Pi Fansubs'
|
||||
extClass = '.PiFansubs'
|
||||
themePkg = 'dooplay'
|
||||
baseUrl = 'https://pifansubs.club'
|
||||
overrideVersionCode = 19
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation(project(':lib:streamhidevid-extractor'))
|
||||
}
|
BIN
src/pt/pifansubs/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/pt/pifansubs/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
src/pt/pifansubs/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/pt/pifansubs/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
src/pt/pifansubs/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/pt/pifansubs/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
src/pt/pifansubs/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/pt/pifansubs/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
BIN
src/pt/pifansubs/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/pt/pifansubs/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
src/pt/pifansubs/res/web_hi_res_512.png
Normal file
BIN
src/pt/pifansubs/res/web_hi_res_512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
|
@ -0,0 +1,64 @@
|
|||
package eu.kanade.tachiyomi.animeextension.pt.pifansubs
|
||||
|
||||
import eu.kanade.tachiyomi.animeextension.pt.pifansubs.extractors.BlembedExtractor
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.streamhidevidextractor.StreamHideVidExtractor
|
||||
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class PiFansubs : DooPlay(
|
||||
"pt-BR",
|
||||
"Pi Fansubs",
|
||||
"https://pifansubs.club",
|
||||
) {
|
||||
|
||||
override fun headersBuilder() = super.headersBuilder()
|
||||
.add("Accept-Language", "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7")
|
||||
|
||||
override val prefQualityValues = arrayOf("360p", "480p", "720p", "1080p")
|
||||
override val prefQualityEntries = prefQualityValues
|
||||
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeSelector(): String = "div#featured-titles div.poster"
|
||||
|
||||
// ============================ Video Links =============================
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val document = response.asJsoup()
|
||||
val players = document.select("div.source-box:not(#source-player-trailer) iframe")
|
||||
return players.map(::getPlayerUrl).flatMap(::getPlayerVideos)
|
||||
}
|
||||
|
||||
private fun getPlayerUrl(player: Element): String {
|
||||
return player.attr("data-src").ifEmpty { player.attr("src") }.let {
|
||||
when {
|
||||
!it.startsWith("http") -> "https:" + it
|
||||
else -> it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val streamHideVidExtractor by lazy { StreamHideVidExtractor(client) }
|
||||
private val blembedExtractor by lazy { BlembedExtractor(client, headers) }
|
||||
|
||||
private fun getPlayerVideos(url: String): List<Video> {
|
||||
return when {
|
||||
"https://vidhide" in url -> streamHideVidExtractor.videosFromUrl(url)
|
||||
"https://blembed" in url -> blembedExtractor.videosFromUrl(url)
|
||||
else -> emptyList<Video>()
|
||||
}
|
||||
}
|
||||
|
||||
// =========================== Anime Details ============================
|
||||
override fun Document.getDescription(): String {
|
||||
return select("$additionalInfoSelector p")
|
||||
.eachText()
|
||||
.joinToString("\n\n") + "\n"
|
||||
}
|
||||
|
||||
// =============================== Latest ===============================
|
||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/episodios/page/$page", headers)
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package eu.kanade.tachiyomi.animeextension.pt.pifansubs.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import eu.kanade.tachiyomi.util.parseAs
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class BlembedExtractor(private val client: OkHttpClient, private val headers: Headers) {
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
val doc = client.newCall(GET(url, headers)).execute()
|
||||
.asJsoup()
|
||||
|
||||
val script = doc.selectFirst("script:containsData(player =)")
|
||||
?.data()
|
||||
?: return emptyList()
|
||||
|
||||
val token = script.substringAfter("kaken = \"").substringBefore('"')
|
||||
val timestamp = System.currentTimeMillis().toString()
|
||||
|
||||
val reqUrl = "https://blembed.com/api/?$token&_=$timestamp"
|
||||
val reqHeaders = headers.newBuilder().add("X-Requested-With", "XMLHttpRequest").build()
|
||||
val res = client.newCall(GET(reqUrl, reqHeaders)).execute()
|
||||
.parseAs<ResponseData>()
|
||||
|
||||
return res.sources.map { Video(it.file, "Blembed - ${it.label}", it.file, headers) }
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ResponseData(val sources: List<VideoDto>) {
|
||||
@Serializable
|
||||
data class VideoDto(val file: String, val label: String)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue