cloudstream-extensions-mult.../NekosamaProvider/src/main/kotlin/com/lagradost/PstreamExtractor.kt

54 lines
1.8 KiB
Kotlin
Raw Normal View History

add VostfreeProvider (#16) * add VostfreeProvider * autoformat the code and add the changes requested * remove com.lagradost.cloudstream3.animeproviders line * optimized the getMainPage * Add Sarlay's provider * fix the research function and reshape the load * Add NekosamaProvider * add fuzzy for computing string distance * correct the name of class * fix and improve the search function * rename nekosama class * Remove no french provider * NekosamaProvider working version * Revert "Remove no french provider" This reverts commit b177de518dd429010b8b8ddc569940d9d11cc6d7. * use of apmap when necessary * Nekosama add more results items from search * Load function of vostfree optimized * "" * resolve conflict * Add WiflixProvider * Change title and use apmap * No vostfree reference * Add tags and complete season * precise dub ou sub * Update FrenchStream * not anime movie * Fix load movie for vostfree * Add vido extractor for frenchStream * fix reference vido * doodstream work for Wiflix * Udate vidoExtractor to take in account Wiflix ! Optimized FrenchStream to take directly the redirected link * In Frenchstream dood is in reality streamlare * Get MesFilmsProvider directly at Sarlay repository * Requested changes are done * Add showStatus to NekoSamaProvider * show news episodes for neko-sama * Requested changes done * Add year for episodes * French Stream change his mainUrl * Improve research for wiflix * add year of episodes and show the latest episode for vostfree * Add more provider for Wiflix * open the good extractor * Fix Extractor * change authors Co-authored-by: Eddy <kingkama976@gmail.com>
2022-09-26 15:20:08 +00:00
package com.lagradost
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.app
import okio.ByteString.Companion.decodeBase64
open class PstreamExtractor : ExtractorApi() {
override val name: String = "Pstream"
override val mainUrl: String = "https://www.pstream.net"
override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val refer = url
val headers = mapOf(
"Accept" to "*/*",
"Accept-Language" to "en-US,en;q=0.5",
)
val document = app.get(url, headers = headers).document
val scriptsourceUrl =
document.select("""script[src^="https://www.pstream.net/u/player-script?"]""")
.attr("src")//** Get the url where the scritp function is **/
val Scripdocument =
app.get(scriptsourceUrl, headers = headers).document//** Open the scritp function **/
val base64CodeRegex =
Regex("""e\.parseJSON\(atob\(t\)\.slice\(2\)\)\}\(\"(.*)\=\="\)\,n\=\"""") //** Search the code64 **/
val code64 = base64CodeRegex.find(Scripdocument.toString())?.groupValues?.get(1)
val decoded = code64?.decodeBase64()?.utf8() //** decode the code64 **/
val regexLink = Regex("""\"(https:\\\/\\\/[^"]*)""") //** Extract the m3u8 link **/
val m3u8found = regexLink.find(decoded.toString())?.groupValues?.get(1)
var m3u8 = m3u8found.toString().replace("""\""", "")
return listOf(
ExtractorLink(
name,
name,
m3u8,
refer, // voir si site demande le referer à mettre ici
Qualities.Unknown.value,
true,
headers = headers
)
)
}
}