mirror of
				https://github.com/hexated/cloudstream-extensions-hexated.git
				synced 2024-08-15 00:03:22 +00:00 
			
		
		
		
	TimefourTv: fix daddy again
This commit is contained in:
		
							parent
							
								
									36c6022afa
								
							
						
					
					
						commit
						05f2bce9a8
					
				
					 4 changed files with 17 additions and 16 deletions
				
			
		|  | @ -918,7 +918,7 @@ suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): Map<S | ||||||
|             Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1) |             Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     var phpsessid = session.baseClient.cookieJar.loadForRequest(url.toHttpUrl()) |     val phpsessid = session.baseClient.cookieJar.loadForRequest(url.toHttpUrl()) | ||||||
|         .first { it.name == "PHPSESSID" }.value |         .first { it.name == "PHPSESSID" }.value | ||||||
| 
 | 
 | ||||||
|     session.post( |     session.post( | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| // use an integer for version numbers | // use an integer for version numbers | ||||||
| version = 16 | version = 17 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| cloudstream { | cloudstream { | ||||||
|  |  | ||||||
|  | @ -1,15 +1,16 @@ | ||||||
| package com.hexated | package com.hexated | ||||||
| 
 | 
 | ||||||
|  | import com.hexated.TimefourTvExtractor.getBaseUrl | ||||||
| import com.hexated.TimefourTvExtractor.getLink | import com.hexated.TimefourTvExtractor.getLink | ||||||
| import com.lagradost.cloudstream3.* | import com.lagradost.cloudstream3.* | ||||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | import com.lagradost.cloudstream3.utils.ExtractorLink | ||||||
| import com.lagradost.cloudstream3.utils.M3u8Helper | import com.lagradost.cloudstream3.utils.M3u8Helper | ||||||
| import org.jsoup.Jsoup | import org.jsoup.Jsoup | ||||||
| import org.jsoup.nodes.Element | import org.jsoup.nodes.Element | ||||||
| import java.net.URI |  | ||||||
| 
 | 
 | ||||||
| open class TimefourTv : MainAPI() { | open class TimefourTv : MainAPI() { | ||||||
|     final override var mainUrl = "https://time4tv.stream" |     final override var mainUrl = "https://time4tv.stream" | ||||||
|  |     var daddyUrl = "https://daddylivehd.com" | ||||||
|     override var name = "Time4tv" |     override var name = "Time4tv" | ||||||
|     override val hasDownloadSupport = false |     override val hasDownloadSupport = false | ||||||
|     override val hasMainPage = true |     override val hasMainPage = true | ||||||
|  | @ -18,14 +19,6 @@ open class TimefourTv : MainAPI() { | ||||||
|         TvType.Live |         TvType.Live | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     companion object { |  | ||||||
|         const val daddyUrl = "https://daddylivehd.com" |  | ||||||
|         val daddyHost: String = daddyUrl.getHost() |  | ||||||
|         private fun String.getHost(): String { |  | ||||||
|             return URI(this).host.substringBeforeLast(".").substringAfterLast(".") |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     override val mainPage = mainPageOf( |     override val mainPage = mainPageOf( | ||||||
|         "$mainUrl/tv-channels" to "All Channels", |         "$mainUrl/tv-channels" to "All Channels", | ||||||
|         "$mainUrl/usa-channels" to "USA Channels", |         "$mainUrl/usa-channels" to "USA Channels", | ||||||
|  | @ -145,6 +138,7 @@ open class TimefourTv : MainAPI() { | ||||||
|     override suspend fun load(url: String): LoadResponse? { |     override suspend fun load(url: String): LoadResponse? { | ||||||
| 
 | 
 | ||||||
|         val res = app.get(url) |         val res = app.get(url) | ||||||
|  |         daddyUrl = getBaseUrl(res.url) | ||||||
|         if (!res.isSuccessful) return loadSchedule(url) |         if (!res.isSuccessful) return loadSchedule(url) | ||||||
| 
 | 
 | ||||||
|         val document = res.document |         val document = res.document | ||||||
|  | @ -177,9 +171,11 @@ open class TimefourTv : MainAPI() { | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } ?: listOf( |             } ?: listOf( | ||||||
|             Episode( |             newEpisode( | ||||||
|                 document.selectFirst("div#content iframe")?.attr("src") ?: return null, title |                 document.selectFirst("div#content iframe#thatframe")?.attr("src") ?: return null | ||||||
|             ) |             ) { | ||||||
|  |                 this.name = title | ||||||
|  |             } | ||||||
|         ) ?: throw ErrorLoadingException("Refresh page") |         ) ?: throw ErrorLoadingException("Refresh page") | ||||||
|         return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { |         return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { | ||||||
|             this.posterUrl = poster |             this.posterUrl = poster | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ var mainServer: String? = null | ||||||
| 
 | 
 | ||||||
| object TimefourTvExtractor : TimefourTv() { | object TimefourTvExtractor : TimefourTv() { | ||||||
| 
 | 
 | ||||||
|     private fun getBaseUrl(url: String): String { |     fun getBaseUrl(url: String): String { | ||||||
|         return URI(url).let { |         return URI(url).let { | ||||||
|             "${it.scheme}://${it.host}" |             "${it.scheme}://${it.host}" | ||||||
|         } |         } | ||||||
|  | @ -72,7 +72,7 @@ object TimefourTvExtractor : TimefourTv() { | ||||||
|             return getSportLink(url) |             return getSportLink(url) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if(url.contains(daddyHost, true)) { |         if(url.contains(daddyUrl.getHost(), true)) { | ||||||
|             mainServer = getBaseUrl(url) |             mainServer = getBaseUrl(url) | ||||||
|             return getFinalLink(app.get(url, referer = daddyUrl)) |             return getFinalLink(app.get(url, referer = daddyUrl)) | ||||||
|         } |         } | ||||||
|  | @ -126,4 +126,9 @@ object TimefourTvExtractor : TimefourTv() { | ||||||
|                 ?.joinToString("") |                 ?.joinToString("") | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     private fun String.getHost(): String { | ||||||
|  |         return URI(this).host.substringBeforeLast(".").substringAfterLast(".") | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue