mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Update Dailymotion Extractor (#1081)
This commit is contained in:
parent
0a5399d9b6
commit
3874cb9f9d
2 changed files with 20 additions and 8 deletions
|
@ -9,10 +9,16 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
|
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
|
class Geodailymotion : Dailymotion() {
|
||||||
|
override val name = "GeoDailymotion"
|
||||||
|
override val mainUrl = "https://geo.dailymotion.com"
|
||||||
|
}
|
||||||
|
|
||||||
open class Dailymotion : ExtractorApi() {
|
open class Dailymotion : ExtractorApi() {
|
||||||
override val mainUrl = "https://www.dailymotion.com"
|
override val mainUrl = "https://www.dailymotion.com"
|
||||||
override val name = "Dailymotion"
|
override val name = "Dailymotion"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
private val baseUrl = "https://www.dailymotion.com"
|
||||||
|
|
||||||
@Suppress("RegExpSimplifiable")
|
@Suppress("RegExpSimplifiable")
|
||||||
private val videoIdRegex = "^[kx][a-zA-Z0-9]+\$".toRegex()
|
private val videoIdRegex = "^[kx][a-zA-Z0-9]+\$".toRegex()
|
||||||
|
@ -34,7 +40,7 @@ open class Dailymotion : ExtractorApi() {
|
||||||
val dmV1st = config.dmInternalData.v1st
|
val dmV1st = config.dmInternalData.v1st
|
||||||
val dmTs = config.dmInternalData.ts
|
val dmTs = config.dmInternalData.ts
|
||||||
val embedder = config.context.embedder
|
val embedder = config.context.embedder
|
||||||
val metaDataUrl = "$mainUrl/player/metadata/video/$id?embedder=$embedder&locale=en-US&dmV1st=$dmV1st&dmTs=$dmTs&is_native_app=0"
|
val metaDataUrl = "$baseUrl/player/metadata/video/$id?embedder=$embedder&locale=en-US&dmV1st=$dmV1st&dmTs=$dmTs&is_native_app=0"
|
||||||
val metaData = app.get(metaDataUrl, referer = embedUrl, cookies = req.cookies)
|
val metaData = app.get(metaDataUrl, referer = embedUrl, cookies = req.cookies)
|
||||||
.parsedSafe<MetaData>() ?: return
|
.parsedSafe<MetaData>() ?: return
|
||||||
metaData.qualities.forEach { (_, video) ->
|
metaData.qualities.forEach { (_, video) ->
|
||||||
|
@ -45,16 +51,19 @@ open class Dailymotion : ExtractorApi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getEmbedUrl(url: String): String? {
|
private fun getEmbedUrl(url: String): String? {
|
||||||
if (url.contains("/embed/")) {
|
if (url.contains("/embed/") || url.contains("/video/")) {
|
||||||
return url
|
return url
|
||||||
}
|
|
||||||
val vid = getVideoId(url) ?: return null
|
|
||||||
return "$mainUrl/embed/video/$vid"
|
|
||||||
}
|
}
|
||||||
|
if (url.contains("geo.dailymotion.com")) {
|
||||||
|
val videoId = url.substringAfter("video=")
|
||||||
|
return "$baseUrl/embed/video/$videoId"
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
private fun getVideoId(url: String): String? {
|
private fun getVideoId(url: String): String? {
|
||||||
val path = URL(url).path
|
val path = URL(url).path
|
||||||
val id = path.substringAfter("video/")
|
val id = path.substringAfter("/video/")
|
||||||
if (id.matches(videoIdRegex)) {
|
if (id.matches(videoIdRegex)) {
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ import com.lagradost.cloudstream3.extractors.FileMoonIn
|
||||||
import com.lagradost.cloudstream3.extractors.FileMoonSx
|
import com.lagradost.cloudstream3.extractors.FileMoonSx
|
||||||
import com.lagradost.cloudstream3.extractors.Filesim
|
import com.lagradost.cloudstream3.extractors.Filesim
|
||||||
import com.lagradost.cloudstream3.extractors.Fplayer
|
import com.lagradost.cloudstream3.extractors.Fplayer
|
||||||
|
import com.lagradost.cloudstream3.extractors.Geodailymotion
|
||||||
import com.lagradost.cloudstream3.extractors.GMPlayer
|
import com.lagradost.cloudstream3.extractors.GMPlayer
|
||||||
import com.lagradost.cloudstream3.extractors.Gdriveplayer
|
import com.lagradost.cloudstream3.extractors.Gdriveplayer
|
||||||
import com.lagradost.cloudstream3.extractors.Gdriveplayerapi
|
import com.lagradost.cloudstream3.extractors.Gdriveplayerapi
|
||||||
|
@ -900,7 +901,9 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
Simpulumlamerop(),
|
Simpulumlamerop(),
|
||||||
Urochsunloath(),
|
Urochsunloath(),
|
||||||
Yipsu(),
|
Yipsu(),
|
||||||
MetaGnathTuggers()
|
MetaGnathTuggers(),
|
||||||
|
Geodailymotion(),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue