New Source [VostFree] (#354)
This commit is contained in:
committed by
GitHub
parent
5594a491e0
commit
3c7386f566
2
src/fr/vostfree/AndroidManifest.xml
Normal file
2
src/fr/vostfree/AndroidManifest.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="eu.kanade.tachiyomi.animeextension" />
|
12
src/fr/vostfree/build.gradle
Normal file
12
src/fr/vostfree/build.gradle
Normal file
@ -0,0 +1,12 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
ext {
|
||||
extName = 'Vostfree'
|
||||
pkgNameSuffix = 'fr.vostfree'
|
||||
extClass = '.Vostfree'
|
||||
extVersionCode = 1
|
||||
libVersion = '12'
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
BIN
src/fr/vostfree/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/fr/vostfree/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
src/fr/vostfree/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/fr/vostfree/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
src/fr/vostfree/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/fr/vostfree/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
src/fr/vostfree/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/fr/vostfree/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
src/fr/vostfree/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/fr/vostfree/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,257 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.vostfree
|
||||
|
||||
import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.DoodExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.OkruExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.VudeoExtractor
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.lang.Exception
|
||||
|
||||
class Vostfree : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
override val name = "Vostfree"
|
||||
|
||||
override val baseUrl = "https://vostfree.tv"
|
||||
|
||||
override val lang = "fr"
|
||||
|
||||
override val supportsLatest = false
|
||||
|
||||
override val client: OkHttpClient = network.cloudflareClient
|
||||
|
||||
private val preferences: SharedPreferences by lazy {
|
||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||
}
|
||||
|
||||
override fun popularAnimeSelector(): String = "div#page-content div.page-left div#content div#dle-content div.movie-poster"
|
||||
|
||||
override fun popularAnimeRequest(page: Int): Request = GET("https://vostfree.tv/films-vf-vostfr/page/$page/")
|
||||
|
||||
override fun popularAnimeFromElement(element: Element): SAnime {
|
||||
Log.i("bruh", "${element.baseUri()}")
|
||||
val anime = SAnime.create()
|
||||
anime.setUrlWithoutDomain(
|
||||
element.select("div.play a").attr("href")
|
||||
)
|
||||
anime.title = element.select("div.info.hidden div.title").text()
|
||||
anime.thumbnail_url = baseUrl + element.select("span.image img").attr("src")
|
||||
return anime
|
||||
}
|
||||
|
||||
override fun popularAnimeNextPageSelector(): String = "span.next-page"
|
||||
|
||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||
val episodes = mutableListOf<SEpisode>()
|
||||
val jsoup = response.asJsoup()
|
||||
jsoup.select("select.new_player_selector option").forEach { it ->
|
||||
val epNum = it.text().replace("Episode", "").drop(2)
|
||||
Log.i("Bruh", "Episodio:$epNum")
|
||||
Log.i("bruh", "${response.request.url}-episode:0;")
|
||||
|
||||
if (it.text() == "Film") {
|
||||
val episode = SEpisode.create().apply {
|
||||
episode_number = "1".toFloat()
|
||||
name = "Film"
|
||||
date_upload = System.currentTimeMillis()
|
||||
}
|
||||
episode.url = ("?episode:${0}/${response.request.url}")
|
||||
episodes.add(episode)
|
||||
} else {
|
||||
val episode = SEpisode.create().apply {
|
||||
episode_number = epNum.toFloat()
|
||||
name = "Épisode $epNum"
|
||||
date_upload = System.currentTimeMillis()
|
||||
}
|
||||
episode.setUrlWithoutDomain("?episode:${epNum.toInt() - 1}/${response.request.url}")
|
||||
episodes.add(episode)
|
||||
}
|
||||
}
|
||||
|
||||
return episodes
|
||||
}
|
||||
|
||||
override fun episodeListSelector() = throw Exception("not used")
|
||||
|
||||
override fun episodeFromElement(element: Element) = throw Exception("not used")
|
||||
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
Log.i("bruh", "aaa${response.request.url}")
|
||||
val epNum = response.request.url.toString().substringAfter("https://vostfree.tv/?episode:").substringBefore("/")
|
||||
val realUrl = response.request.url.toString().replace("https://vostfree.tv/?episode:$epNum/", "")
|
||||
Log.i("bruh", "RealURL: $realUrl")
|
||||
val document = Jsoup.connect(realUrl).get()
|
||||
val videoList = mutableListOf<Video>()
|
||||
val allPlayerIds = document.select("div.tab-content div div.new_player_top div.new_player_bottom div.button_box")[epNum.toInt()]
|
||||
|
||||
allPlayerIds.select("div").forEach() {
|
||||
val server = it.text()
|
||||
if (server == "Vudeo") {
|
||||
val playerId = it.attr("id")
|
||||
val url = document.select("div#player-tabs div.tab-blocks div.tab-content div div#content_$playerId").text()
|
||||
val video = VudeoExtractor(client).videosFromUrl(url)
|
||||
videoList.addAll(video)
|
||||
}
|
||||
if (server == "OK") {
|
||||
val playerId = it.attr("id")
|
||||
val url = "https://ok.ru/videoembed/" + document.select("div#player-tabs div.tab-blocks div.tab-content div div#content_$playerId").text()
|
||||
val video = OkruExtractor(client).videosFromUrl(url)
|
||||
videoList.addAll(video)
|
||||
}
|
||||
if (server == "Doodstream") {
|
||||
val playerId = it.attr("id")
|
||||
val url = document.select("div#player-tabs div.tab-blocks div.tab-content div div#content_$playerId").text()
|
||||
val video = DoodExtractor(client).videoFromUrl(url, "DoodStream")
|
||||
if (video != null) {
|
||||
videoList.add(video)
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.i("bruh", "test1")
|
||||
|
||||
return videoList
|
||||
}
|
||||
|
||||
override fun videoListSelector() = throw Exception("not used")
|
||||
|
||||
override fun videoUrlParse(document: Document) = throw Exception("not used")
|
||||
|
||||
override fun videoFromElement(element: Element) = throw Exception("not used")
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString("preferred_quality", "StreamTape")
|
||||
if (quality != null) {
|
||||
val newList = mutableListOf<Video>()
|
||||
var preferred = 0
|
||||
for (video in this) {
|
||||
if (video.quality == quality) {
|
||||
newList.add(preferred, video)
|
||||
preferred++
|
||||
} else {
|
||||
newList.add(video)
|
||||
}
|
||||
}
|
||||
return newList
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||
val filterList = if (filters.isEmpty()) getFilterList() else filters
|
||||
val typeFilter = filterList.find { it is TypeFilter } as TypeFilter
|
||||
val genreFilter = filterList.find { it is GenreFilter } as GenreFilter
|
||||
|
||||
return if (typeFilter.state != 0) {
|
||||
GET("https://vostfree.tv/${typeFilter.toUriPart()}/page/$page/")
|
||||
} else {
|
||||
if (query.isNotBlank()) {
|
||||
throw Exception("Recherche non prise en charge")
|
||||
} else {
|
||||
if (genreFilter.state != 0) {
|
||||
GET("https://vostfree.tv/genre/${genreFilter.toUriPart()}/page/$page/")
|
||||
} else {
|
||||
GET("https://vostfree.tv/films-vf-vostfr/page/$page/")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun searchAnimeFromElement(element: Element): SAnime {
|
||||
return popularAnimeFromElement(element)
|
||||
}
|
||||
|
||||
override fun searchAnimeNextPageSelector(): String = popularAnimeNextPageSelector()
|
||||
|
||||
override fun searchAnimeSelector(): String = popularAnimeSelector()
|
||||
|
||||
override fun animeDetailsParse(document: Document): SAnime {
|
||||
val anime = SAnime.create()
|
||||
anime.title = document.select("div.slide-middle h1").text()
|
||||
anime.description = document.select("div.slide-desc").first().ownText()
|
||||
anime.genre = document.select("div.image-bg-content div.slide-block div.slide-middle ul.slide-top li.right a").joinToString { it.text() }
|
||||
return anime
|
||||
}
|
||||
|
||||
override fun latestUpdatesNextPageSelector() = throw Exception("not used")
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element) = throw Exception("not used")
|
||||
|
||||
override fun latestUpdatesRequest(page: Int) = throw Exception("not used")
|
||||
|
||||
override fun latestUpdatesSelector() = throw Exception("not used")
|
||||
|
||||
override fun getFilterList(): AnimeFilterList = AnimeFilterList(
|
||||
TypeFilter(),
|
||||
GenreFilter()
|
||||
)
|
||||
|
||||
private class TypeFilter : UriPartFilter(
|
||||
"types",
|
||||
arrayOf(
|
||||
Pair("<pour sélectionner>", ""),
|
||||
Pair("Animes VF", "animes-vf"),
|
||||
Pair("Animes VOSTFR", "animes-vostfr"),
|
||||
Pair("FILMS", "films-vf-vostfr")
|
||||
)
|
||||
)
|
||||
|
||||
private class GenreFilter : UriPartFilter(
|
||||
"genre",
|
||||
arrayOf(
|
||||
Pair("<pour sélectionner>", ""),
|
||||
Pair("Action", "Action"),
|
||||
Pair("Comédie", "Comédie"),
|
||||
Pair("Drame", "Drame"),
|
||||
Pair("Surnaturel", "Surnaturel"),
|
||||
Pair("Shonen", "Shonen"),
|
||||
Pair("Romance", "Romance"),
|
||||
Pair("Tranche de vie", "Tranche+de+vie"),
|
||||
Pair("Fantasy", "Fantasy"),
|
||||
Pair("Mystère", "Mystère"),
|
||||
Pair("Psychologique", "Psychologique"),
|
||||
Pair("Sci-Fi", "Sci-Fi")
|
||||
)
|
||||
)
|
||||
|
||||
private open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
|
||||
AnimeFilter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
||||
fun toUriPart() = vals[state].second
|
||||
}
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val videoQualityPref = ListPreference(screen.context).apply {
|
||||
key = "preferred_quality"
|
||||
title = "Preferred quality"
|
||||
entries = arrayOf("StreamTape")
|
||||
entryValues = arrayOf("StreamTape")
|
||||
setDefaultValue("StreamTape")
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
screen.addPreference(videoQualityPref)
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class DoodExtractor(private val client: OkHttpClient) {
|
||||
fun videoFromUrl(url: String, quality: String): Video? {
|
||||
val response = client.newCall(GET(url)).execute()
|
||||
val doodTld = url.substringAfter("https://dood.").substringBefore("/")
|
||||
val content = response.body!!.string()
|
||||
if (!content.contains("'/pass_md5/")) return null
|
||||
val md5 = content.substringAfter("'/pass_md5/").substringBefore("',")
|
||||
val token = md5.substringAfterLast("/")
|
||||
val randomString = getRandomString()
|
||||
val expiry = System.currentTimeMillis()
|
||||
val videoUrlStart = client.newCall(
|
||||
GET(
|
||||
"https://dood.$doodTld/pass_md5/$md5",
|
||||
Headers.headersOf("referer", url)
|
||||
)
|
||||
).execute().body!!.string()
|
||||
val videoUrl = "$videoUrlStart$randomString?token=$token&expiry=$expiry"
|
||||
|
||||
return Video(url, quality, videoUrl, null, doodHeaders(doodTld))
|
||||
}
|
||||
|
||||
private fun getRandomString(length: Int = 10): String {
|
||||
val allowedChars = ('A'..'Z') + ('a'..'z') + ('0'..'9')
|
||||
return (1..length)
|
||||
.map { allowedChars.random() }
|
||||
.joinToString("")
|
||||
}
|
||||
|
||||
private fun doodHeaders(tld: String) = Headers.Builder().apply {
|
||||
add("User-Agent", "Aniyomi")
|
||||
add("Referer", "https://dood.$tld/")
|
||||
}.build()
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.jkhentai.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.Connection
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class FembedExtractor {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
val videoApi = url.replace("/v/", "/api/source/")
|
||||
val json = JSONObject(Jsoup.connect(videoApi).ignoreContentType(true).method(Connection.Method.POST).execute().body())
|
||||
val videoList = mutableListOf<Video>()
|
||||
if (json.getBoolean("success")) {
|
||||
val videoList = mutableListOf<Video>()
|
||||
val jsonArray = json.getJSONArray("data")
|
||||
for (i in 0 until jsonArray.length()) {
|
||||
val `object` = jsonArray.getJSONObject(i)
|
||||
val videoUrl = `object`.getString("file")
|
||||
val quality = "Fembed:" + `object`.getString("label")
|
||||
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
||||
}
|
||||
return videoList
|
||||
} else {
|
||||
val videoUrl = "not used"
|
||||
val quality = "Video taken down for dmca"
|
||||
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class OkruExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val videoList = mutableListOf<Video>()
|
||||
val videosString = document.select("div[data-options]").attr("data-options")
|
||||
.substringAfter("\\\"videos\\\":[{\\\"name\\\":\\\"")
|
||||
.substringBefore("]")
|
||||
videosString.split("{\\\"name\\\":\\\"").reversed().forEach {
|
||||
val videoUrl = it.substringAfter("url\\\":\\\"")
|
||||
.substringBefore("\\\"")
|
||||
.replace("\\\\u0026", "&")
|
||||
val videoQuality = "Okru: " + it.substringBefore("\\\"")
|
||||
if (videoUrl.startsWith("https://")) {
|
||||
videoList.add(Video(videoUrl, videoQuality, videoUrl, null))
|
||||
}
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors
|
||||
|
||||
import android.util.Log
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class VudeoExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
Log.i("bruh", "test12")
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val videoList = mutableListOf<Video>()
|
||||
document.select("script").forEach { script ->
|
||||
if (script.data().contains("sources: [\"")) {
|
||||
val data = script.data().substringAfter("sources: [\"").substringBefore("\"],")
|
||||
val url = data
|
||||
Log.i("bruh", "$url")
|
||||
val videoUrl = url
|
||||
val quality = "Vudeo"
|
||||
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
||||
}
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user