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 b177de518d.

* 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>
This commit is contained in:
Eddy976 2022-09-26 17:20:08 +02:00 committed by GitHub
parent b3c10b3088
commit b368fcce02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 1714 additions and 100 deletions

View file

@ -0,0 +1,26 @@
// use an integer for version numbers
version = 1
cloudstream {
language = "fr"
// All of these properties are optional, you can safely remove them
description = "WIFLIX, le site grâce auquel vous allez pouvoir regarder vos films et séries préférées"
authors = listOf("Eddy")
/**
* Status int as the following:
* 0: Down
* 1: Ok
* 2: Slow
* 3: Beta only
* */
status = 1 // will be 3 if unspecified
tvTypes = listOf(
"TvSeries",
"Movie",
)
iconUrl = "https://www.google.com/s2/favicons?domain=wiflix.zone&sz=%size%"
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.lagradost"/>

View file

@ -0,0 +1,35 @@
package com.lagradost
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
open class DoodStreamExtractor : ExtractorApi() {
override var name = "DoodStream"
override var mainUrl = "https://doodstream.com"
override val requiresReferer = false
override fun getExtractorUrl(id: String): String {
return "$mainUrl/d/$id"
}
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val response0 = app.get(url).text // html of DoodStream page to look for /pass_md5/...
val md5 =mainUrl+(Regex("/pass_md5/[^']*").find(response0)?.value ?: return null) // get https://dood.ws/pass_md5/...
val trueUrl = app.get(md5, referer = url).text + "zUEJeL3mUN?token=" + md5.substringAfterLast("/") //direct link to extract (zUEJeL3mUN is random)
val quality = Regex("\\d{3,4}p").find(response0.substringAfter("<title>").substringBefore("</title>"))?.groupValues?.get(0)
return listOf(
ExtractorLink(
trueUrl,
this.name,
trueUrl,
mainUrl,
getQualityFromName(quality),
false
)
) // links are valid in 8h
}
}

View file

@ -0,0 +1,81 @@
package com.lagradost
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
// This is a modified version of https://github.com/jmir1/aniyomi-extensions/blob/master/src/en/genoanime/src/eu/kanade/tachiyomi/animeextension/en/genoanime/extractors/StreamSBExtractor.kt
// The following code is under the Apache License 2.0 https://github.com/jmir1/aniyomi-extensions/blob/master/LICENSE
open class StreamSBPlusExtractor : ExtractorApi() {
override var name = "StreamSB"
override var mainUrl = "https://sbspeed.com"
override val requiresReferer = false
private val hexArray = "0123456789ABCDEF".toCharArray()
private fun bytesToHex(bytes: ByteArray): String {
val hexChars = CharArray(bytes.size * 2)
for (j in bytes.indices) {
val v = bytes[j].toInt() and 0xFF
hexChars[j * 2] = hexArray[v ushr 4]
hexChars[j * 2 + 1] = hexArray[v and 0x0F]
}
return String(hexChars)
}
data class Subs (
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String,
)
data class StreamData (
@JsonProperty("file") val file: String,
@JsonProperty("cdn_img") val cdnImg: String,
@JsonProperty("hash") val hash: String,
@JsonProperty("subs") val subs: List<Subs>?,
@JsonProperty("length") val length: String,
@JsonProperty("id") val id: String,
@JsonProperty("title") val title: String,
@JsonProperty("backup") val backup: String,
)
data class Main (
@JsonProperty("stream_data") val streamData: StreamData,
@JsonProperty("status_code") val statusCode: Int,
)
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val regexID =
Regex("(embed-[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+|/e/[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
val id = regexID.findAll(url).map {
it.value.replace(Regex("(embed-|/e/)"), "")
}.first()
// val master = "$mainUrl/sources48/6d6144797752744a454267617c7c${bytesToHex.lowercase()}7c7c4e61755a56456f34385243727c7c73747265616d7362/6b4a33767968506e4e71374f7c7c343837323439333133333462353935333633373836643638376337633462333634663539343137373761333635313533333835333763376333393636363133393635366136323733343435323332376137633763373337343732363536313664373336327c7c504d754478413835306633797c7c73747265616d7362"
val master = "$mainUrl/sources48/" + bytesToHex("||$id||||streamsb".toByteArray()) + "/"
val headers = mapOf(
"watchsb" to "sbstream",
)
val mapped = app.get(
master.lowercase(),
headers = headers,
referer = url,
).parsedSafe<Main>()
// val urlmain = mapped.streamData.file.substringBefore("/hls/")
M3u8Helper.generateM3u8(
name,
mapped?.streamData?.file ?: return,
url,
headers = headers
).forEach(callback)
}
}

View file

@ -0,0 +1,307 @@
package com.lagradost
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import org.jsoup.nodes.Element
import org.jsoup.select.Elements
import kotlin.collections.ArrayList
class WiflixProvider : MainAPI() {
override var mainUrl = "https://wiflix.zone"
override var name = "Wiflix"
override val hasQuickSearch = false // recherche rapide (optionel, pas vraimet utile)
override val hasMainPage = true // page d'accueil (optionel mais encoragé)
override var lang = "fr" // fournisseur est en francais
override val supportedTypes =
setOf(TvType.Movie, TvType.TvSeries) // series, films
// liste des types: https://recloudstream.github.io/dokka/app/com.lagradost.cloudstream3/-tv-type/index.html
/**
Cherche le site pour un titre spécifique
La recherche retourne une SearchResponse, qui peut être des classes suivants: AnimeSearchResponse, MovieSearchResponse, TorrentSearchResponse, TvSeriesSearchResponse
Chaque classes nécessite des données différentes, mais a en commun le nom, le poster et l'url
**/
override suspend fun search(query: String): List<SearchResponse> {
val link =
"$mainUrl/index.php?do=search&subaction=search&search_start=0&full_search=1&result_from=1&story=$query&titleonly=3&searchuser=&replyless=0&replylimit=0&searchdate=0&beforeafter=after&sortby=date&resorder=desc&showposts=0&catlist%5B%5D=0" // search'
val document =
app.post(link).document // app.get() permet de télécharger la page html avec une requete HTTP (get)
val results = document.select("div#dle-content > div.clearfix")
val allresultshome =
results.mapNotNull { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
article.toSearchResponse()
}
return allresultshome
}
/**
* charge la page d'informations, il ya toutes les donées, les épisodes, le résumé etc ...
* Il faut retourner soit: AnimeLoadResponse, MovieLoadResponse, TorrentLoadResponse, TvSeriesLoadResponse.
*/
data class EpisodeData(
@JsonProperty("url") val url: String,
@JsonProperty("episodeNumber") val episodeNumber: String,
)
private fun Elements.takeEpisode(url: String, duborSub: String?): ArrayList<Episode> {
val episodes = ArrayList<Episode>()
this.select("ul.eplist > li").forEach {
val strEpisode = it.text()
val strEpisodeN = strEpisode.replace("Episode ", "")
val link =
EpisodeData(
url,
strEpisodeN,
).toJson()
episodes.add(
Episode(
link,
name = duborSub,
episode = strEpisodeN.toInt(),
)
)
}
return episodes
}
override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document //
// url est le lien retourné par la fonction search (la variable href) ou la fonction getMainPage
var episodes = ArrayList<Episode>()
var mediaType: TvType
val episodeFrfound =
document.select("div.blocfr")
val episodeVostfrfound =
document.select("div.blocvostfr")
val title =
document.select("h1[itemprop]").text()
val posterUrl =
document.select("img#posterimg").attr("src")
val yearRegex = Regex("""ate de sortie\: (\d*)""")
val year = yearRegex.find(document.text())?.groupValues?.get(1)
val tags = document.select("[itemprop=genre] > a")
.map { it.text() } // séléctione tous les tags et les ajoutes à une liste
if (episodeFrfound.text().contains("Episode")) {
mediaType = TvType.TvSeries
val duborSub = "Episode en VF"
episodes = episodeFrfound.takeEpisode(url, duborSub)
} else if (episodeVostfrfound.text().contains("Episode")) {
mediaType = TvType.TvSeries
val duborSub = "Episode sous-titré"
episodes = episodeVostfrfound.takeEpisode(url, duborSub)
} else {
mediaType = TvType.Movie
}
///////////////////////////////////////////
///////////////////////////////////////////
var type_rec: TvType
val recommendations =
document.select("div.clearfixme > div > div")?.mapNotNull { element ->
val recTitle =
element.select("a").text() ?: return@mapNotNull null
val image = element.select("a >img")?.attr("src")
val recUrl = element.select("a").attr("href")
type_rec = TvType.TvSeries
if (recUrl.contains("film")) type_rec = TvType.Movie
if (type_rec == TvType.TvSeries) {
TvSeriesSearchResponse(
recTitle,
recUrl,
this.name,
TvType.TvSeries,
image?.let { fixUrl(it) },
)
} else
MovieSearchResponse(
recTitle,
recUrl,
this.name,
TvType.Movie,
image?.let { fixUrl(it) },
)
}
var comingSoon = url.contains("films-prochainement")
if (mediaType == TvType.Movie) {
val description = document.selectFirst("div.screenshots-full")?.text()
?.replace("(.* .ynopsis)".toRegex(), "")
return newMovieLoadResponse(
name = title,
url = url,
type = TvType.Movie,
dataUrl = url
) {
this.posterUrl = fixUrl(posterUrl)
this.plot = description
this.recommendations = recommendations
this.year = year?.toIntOrNull()
this.comingSoon = comingSoon
this.tags = tags
}
} else {
val description = document.selectFirst("span[itemprop=description]")?.text()
return newTvSeriesLoadResponse(
title,
url,
mediaType,
episodes
) {
this.posterUrl = fixUrl(posterUrl)
this.plot = description
this.recommendations = recommendations
this.year = year?.toIntOrNull()
this.comingSoon = comingSoon
this.tags = tags
}
}
}
// récupere les liens .mp4 ou m3u8 directement à partir du paramètre data généré avec la fonction load()
override suspend fun loadLinks(
data: String, // fournit par load()
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
): Boolean {
val parsedInfo =
tryParseJson<EpisodeData>(data)
val url = parsedInfo?.url ?: data
val numeroEpisode = parsedInfo?.episodeNumber ?: null
val document = app.get(url).document
val episodeFrfound =
document.select("div.blocfr")
val episodeVostfrfound =
document.select("div.blocvostfr")
val cssCodeForPlayer = if (episodeFrfound.text().contains("Episode")) {
"div.ep${numeroEpisode}vf > a"
} else if (episodeVostfrfound.text().contains("Episode")) {
"div.ep${numeroEpisode}vs > a"
} else {
"div.linkstab > a"
}
document.select("$cssCodeForPlayer").apmap { player -> // séléctione tous les players
var playerUrl = "https"+player.attr("href").replace("(.*)https".toRegex(), "")
if (!playerUrl.isNullOrBlank())
if (playerUrl.contains("dood")) {
playerUrl = playerUrl.replace("doodstream.com", "dood.wf")
}
loadExtractor(
httpsify(playerUrl),
playerUrl,
subtitleCallback
) { link ->
callback.invoke(
ExtractorLink( // ici je modifie le callback pour ajouter des informations, normalement ce n'est pas nécessaire
link.source,
link.name + "",
link.url,
link.referer,
getQualityFromName("HD"),
link.isM3u8,
link.headers,
link.extractorData
)
)
}
}
return true
}
private fun Element.toSearchResponse(): SearchResponse {
val posterUrl = fixUrl(select("div.img-box > img").attr("src"))
val qualityExtracted = select("div.nbloc1-2 >span").text()
val type = select("div.nbloc3").text()
val title = select("a.nowrap").text()
val link = select("a.nowrap").attr("href")
var quality = when (!qualityExtracted.isNullOrBlank()) {
qualityExtracted.contains("HDLight") -> getQualityFromString("HD")
qualityExtracted.contains("Bdrip") -> getQualityFromString("BlueRay")
qualityExtracted.contains("DVD") -> getQualityFromString("DVD")
qualityExtracted.contains("CAM") -> getQualityFromString("Cam")
else -> null
}
if (type.contains("Film")) {
return MovieSearchResponse(
name = title,
url = link,
apiName = title,
type = TvType.Movie,
posterUrl = posterUrl,
quality = quality
)
} else // an Serie
{
return TvSeriesSearchResponse(
name = title,
url = link,
apiName = title,
type = TvType.TvSeries,
posterUrl = posterUrl,
quality = quality,
//
)
}
}
override val mainPage = mainPageOf(
Pair("$mainUrl/films-prochainement/page/", "Film Prochainement en Streaming"),
Pair("$mainUrl/film-en-streaming/page/", "Top Films cette année"),
Pair("$mainUrl/serie-en-streaming/page/", "Top Séries cette année"),
Pair("$mainUrl/saison-complete/page/", "Les saisons complètes"),
Pair("$mainUrl/film-ancien/page/", "Film zahalé (ancien)")
)
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val url = request.data + page
val document = app.get(url).document
val movies = document.select("div#dle-content > div.clearfix")
val home =
movies.mapNotNull { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
article.toSearchResponse()
}
return newHomePageResponse(request.name, home)
}
}

View file

@ -0,0 +1,18 @@
package com.lagradost
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
import com.lagradost.cloudstream3.plugins.Plugin
import android.content.Context
@CloudstreamPlugin
class WiflixPlugin: Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(WiflixProvider())
registerExtractorAPI(DoodStreamExtractor())
registerExtractorAPI(StreamSBPlusExtractor())
}
}