mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fixed ihavenotv, closes #1292
This commit is contained in:
parent
bb7400638a
commit
30f2b4b782
2 changed files with 16 additions and 3 deletions
|
@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.mvvm.Resource
|
|||
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.schemaStripRegex
|
||||
import org.schabi.newpipe.extractor.ServiceList
|
||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor
|
||||
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory
|
||||
|
@ -35,7 +36,11 @@ open class YoutubeExtractor : ExtractorApi() {
|
|||
val streams = safeApiCall {
|
||||
val streams = ytVideos[url] ?: let {
|
||||
val link =
|
||||
YoutubeStreamLinkHandlerFactory.getInstance().fromUrl(url)
|
||||
YoutubeStreamLinkHandlerFactory.getInstance().fromUrl(
|
||||
url.replace(
|
||||
schemaStripRegex, ""
|
||||
)
|
||||
)
|
||||
|
||||
val s = object : YoutubeStreamExtractor(
|
||||
ServiceList.YouTube,
|
||||
|
|
|
@ -40,7 +40,7 @@ data class ExtractorLinkPlayList(
|
|||
override val headers: Map<String, String> = mapOf(),
|
||||
/** Used for getExtractorVerifierJob() */
|
||||
override val extractorData: String? = null,
|
||||
) : ExtractorLink(
|
||||
) : ExtractorLink(
|
||||
source,
|
||||
name,
|
||||
// Blank as un-used
|
||||
|
@ -92,6 +92,12 @@ data class ExtractorSubtitleLink(
|
|||
override val headers: Map<String, String> = mapOf()
|
||||
) : VideoDownloadManager.IDownloadableMinimum
|
||||
|
||||
/**
|
||||
* Removes https:// and www.
|
||||
* To match urls regardless of schema, perhaps Uri() can be used?
|
||||
*/
|
||||
val schemaStripRegex = Regex("""^(https:|)//(www\.|)""")
|
||||
|
||||
enum class Qualities(var value: Int) {
|
||||
Unknown(400),
|
||||
P144(144), // 144p
|
||||
|
@ -146,7 +152,9 @@ suspend fun loadExtractor(
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
for (extractor in extractorApis) {
|
||||
if (url.startsWith(extractor.mainUrl)) {
|
||||
if (url.replace(schemaStripRegex, "")
|
||||
.startsWith(extractor.mainUrl.replace(schemaStripRegex, ""))
|
||||
) {
|
||||
extractor.getSafeUrl(url, referer)?.forEach(callback)
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue