mirror of
https://github.com/Jacekun/cs3xxx-repo.git
synced 2024-08-14 23:57:09 +00:00
Optimizations and minor fixes.
This commit is contained in:
parent
2ccc4cec3a
commit
cf707a8cd0
12 changed files with 102 additions and 121 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 7
|
||||
version = 8
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.mvvm.logError
|
|||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class JavFreeProvider : MainAPI() {
|
||||
private val globalTvType = TvType.NSFW
|
||||
|
@ -22,8 +21,7 @@ class JavFreeProvider : MainAPI() {
|
|||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val html = app.get(mainUrl).text
|
||||
val document = Jsoup.parse(html)
|
||||
val document = app.get(mainUrl).document
|
||||
val all = ArrayList<HomePageList>()
|
||||
|
||||
document.getElementsByTag("body").select("div#page")
|
||||
|
@ -42,9 +40,9 @@ class JavFreeProvider : MainAPI() {
|
|||
val link = fixUrlNull(aa?.attr("href")) ?: return@mapNotNull null
|
||||
val name = aa?.attr("title") ?: "<No Title>"
|
||||
|
||||
var image = aa?.select("div")?.select("img")?.attr("data-src")
|
||||
if (image.isNullOrBlank()) {
|
||||
image = aa?.select("div")?.select("video")?.attr("poster")
|
||||
val image = aa?.select("div")?.select("img")?.attr("data-src")
|
||||
.orEmpty().ifBlank {
|
||||
aa?.select("div")?.select("video")?.attr("poster")
|
||||
}
|
||||
val year = null
|
||||
|
||||
|
@ -80,11 +78,10 @@ class JavFreeProvider : MainAPI() {
|
|||
val url = fixUrlNull(aa.attr("href")) ?: return@mapNotNull null
|
||||
val title = aa.attr("title")
|
||||
val year = null
|
||||
var image = aa.select("div.post-thumbnail.thumbs-rotation")
|
||||
.select("img").attr("data-src")
|
||||
if (image.isNullOrBlank()) {
|
||||
image = aa.select("div").select("video").attr("poster").toString()
|
||||
}
|
||||
val image = aa.select("div.post-thumbnail.thumbs-rotation")
|
||||
.select("img").attr("data-src").orEmpty().ifBlank {
|
||||
aa.select("div").select("video").attr("poster").toString()
|
||||
}
|
||||
|
||||
MovieSearchResponse(
|
||||
name = title,
|
||||
|
@ -111,15 +108,18 @@ class JavFreeProvider : MainAPI() {
|
|||
//Log.i(this.name, "Result => (yearElem) ${yearElem}")
|
||||
val year = yearElem.text().trim().takeLast(4).toIntOrNull()
|
||||
|
||||
var streamUrl = body
|
||||
val streamUrl = body
|
||||
.select("div#page > div#content > div#primary > main > article > header > div > div > div > script")
|
||||
.toString()
|
||||
if (streamUrl.isNotEmpty()) {
|
||||
val startS = "<iframe src="
|
||||
streamUrl = streamUrl.substring(streamUrl.indexOf(startS) + startS.length + 1)
|
||||
//Log.i(this.name, "Result => (id) ${id}")
|
||||
streamUrl = streamUrl.substring(0, streamUrl.indexOf("\""))
|
||||
}
|
||||
.toString().run {
|
||||
if (this.isNotBlank()) {
|
||||
val startS = "<iframe src="
|
||||
val streamUrlClean = this.substring(this.indexOf(startS) + startS.length + 1)
|
||||
//Log.i(this.name, "Result => (id) ${id}")
|
||||
streamUrlClean.substring(0, streamUrlClean.indexOf("\""))
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
//Log.i(this.name, "Result => (id) ${id}")
|
||||
return MovieLoadResponse(
|
||||
name = title,
|
||||
|
@ -153,7 +153,7 @@ class JavFreeProvider : MainAPI() {
|
|||
if (linkUrl.isNotBlank()) {
|
||||
//Log.i(this.name, "ApiError => (link url) $linkUrl")
|
||||
loadExtractor(
|
||||
url= linkUrl,
|
||||
url = linkUrl,
|
||||
referer = referer,
|
||||
subtitleCallback = subtitleCallback,
|
||||
callback = callback
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 4
|
||||
version = 5
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.lagradost.cloudstream3.MainAPI
|
|||
import com.lagradost.cloudstream3.TvType
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.app
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class JavGuru : MainAPI() {
|
||||
private val DEV = "DevDebug"
|
||||
|
@ -21,11 +20,9 @@ class JavGuru : MainAPI() {
|
|||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val html = app.get(mainUrl).text
|
||||
val document = Jsoup.parse(html)
|
||||
val all = ArrayList<HomePageList>()
|
||||
|
||||
val mainbody = document.getElementsByTag("body").select("div#page")
|
||||
val mainbody = app.get(mainUrl).document.getElementsByTag("body").select("div#page")
|
||||
.select("div#content").select("div#primary")
|
||||
.select("main")
|
||||
|
||||
|
@ -44,7 +41,7 @@ class JavGuru : MainAPI() {
|
|||
|
||||
val imgArticle = aa?.select("img")
|
||||
val name = imgArticle?.attr("alt") ?: "<No Title>"
|
||||
var image = imgArticle?.attr("src") ?: ""
|
||||
val image = imgArticle?.attr("src")
|
||||
val year = null
|
||||
|
||||
MovieSearchResponse(
|
||||
|
@ -69,15 +66,15 @@ class JavGuru : MainAPI() {
|
|||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/?s=${query}"
|
||||
val html = app.get(url).text
|
||||
val document = Jsoup.parse(html).select("main.site-main").select("div.row")
|
||||
|
||||
return document.map {
|
||||
return app.get(url).document
|
||||
.select("main.site-main").select("div.row").mapNotNull {
|
||||
|
||||
val aa = it.select("div.column").select("div.inside-article")
|
||||
.select("div.imgg").select("a")
|
||||
val imgrow = aa.select("img")
|
||||
.select("div.imgg").select("a") ?: return@mapNotNull null
|
||||
val imgrow = aa.select("img") ?: return@mapNotNull null
|
||||
|
||||
val href = fixUrl(aa.attr("href"))
|
||||
val href = fixUrlNull(aa.attr("href")) ?: return@mapNotNull null
|
||||
val title = imgrow.attr("alt")
|
||||
val image = imgrow.attr("src").trim('\'')
|
||||
val year = Regex("(?<=\\/)(.[0-9]{3})(?=\\/)")
|
||||
|
@ -95,11 +92,8 @@ class JavGuru : MainAPI() {
|
|||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
//Log.i(DEV, "Url => ${url}")
|
||||
val body = document.getElementsByTag("body")
|
||||
val body = app.get(url).document.getElementsByTag("body")
|
||||
.select("div#page")
|
||||
.select("div#content").select("div.content-area")
|
||||
.select("main").select("article")
|
||||
|
@ -112,8 +106,8 @@ class JavGuru : MainAPI() {
|
|||
val title = body.select("h1.titl").text()
|
||||
val descript = body.select("div.wp-content").select("p").firstOrNull()?.text()
|
||||
val streamUrl = ""
|
||||
val year = body.select("div.infometa > div.infoleft > ul > li")
|
||||
?.get(1)?.text()?.takeLast(10)?.substring(0, 4)?.toIntOrNull()
|
||||
val infometa_list = body.select("div.infometa > div.infoleft > ul > li")
|
||||
val year = infometa_list.getOrNull(1)?.text()?.takeLast(10)?.substring(0, 4)?.toIntOrNull()
|
||||
|
||||
return MovieLoadResponse(
|
||||
name = title,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -8,15 +8,16 @@ import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
|||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import org.jsoup.nodes.Element
|
||||
import org.jsoup.select.Elements
|
||||
|
||||
class JavHD : MainAPI() {
|
||||
private val globalTvType = TvType.NSFW
|
||||
override var name = "JavHD"
|
||||
override var mainUrl = "https://javhd.icu"
|
||||
override val supportedTypes: Set<TvType> get() = setOf(TvType.NSFW)
|
||||
override val hasDownloadSupport: Boolean get() = true
|
||||
override val hasMainPage: Boolean get() = true
|
||||
override val hasQuickSearch: Boolean get() = false
|
||||
override val supportedTypes = setOf(TvType.NSFW)
|
||||
override val hasDownloadSupport = true
|
||||
override val hasMainPage = true
|
||||
override val hasQuickSearch = false
|
||||
|
||||
override val mainPage = mainPageOf(
|
||||
"$mainUrl/page/" to "Main Page",
|
||||
|
@ -49,41 +50,7 @@ class JavHD : MainAPI() {
|
|||
val title = if (pair.isNotEmpty()) { pair[0].second } else { "<No Name Row>" }
|
||||
// Fetch list of items and map
|
||||
val inner = it2.select("div.col-md-3.col-sm-6.col-xs-6.item.responsive-height.post")
|
||||
val elements: List<SearchResponse> = inner.mapNotNull {
|
||||
// Inner element
|
||||
//Log.i(this.name, "Result => ${it.selectFirst("div.item-img > a")}")
|
||||
val aa = it.selectFirst("div.item-img > a") ?: return@mapNotNull null
|
||||
// Video details
|
||||
val link = aa.attr("href") ?: return@mapNotNull null
|
||||
val name = aa.attr("title").cleanTitle()
|
||||
var image = aa.select("img").attr("src")
|
||||
//Get another image from 'srcset' element
|
||||
if (image.isNullOrBlank()) {
|
||||
run breaking@ {
|
||||
aa.select("img").attr("srcset").split("\\s+".toRegex())
|
||||
.forEach { imgItem ->
|
||||
image = imgItem.trim()
|
||||
if (image.startsWith("https")) {
|
||||
return@breaking
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val year = null
|
||||
//Log.i(this.name, "Result => (link) ${link}")
|
||||
//Log.i(this.name, "Result => (image) ${image}")
|
||||
|
||||
MovieSearchResponse(
|
||||
name = name,
|
||||
url = link,
|
||||
apiName = this.name,
|
||||
type = globalTvType,
|
||||
posterUrl = image,
|
||||
year = year,
|
||||
id = null,
|
||||
)
|
||||
}.distinctBy { a -> a.url }
|
||||
|
||||
val elements = inner.toSearchResponse()
|
||||
if (elements.isNotEmpty()) {
|
||||
homePageList.add(
|
||||
HomePageList(
|
||||
|
@ -111,25 +78,7 @@ class JavHD : MainAPI() {
|
|||
.select("div.row.video-section.meta-maxwidth-230")
|
||||
.select("div.item.responsive-height.col-md-4.col-sm-6.col-xs-6")
|
||||
//Log.i(this.name, "Result => $document")
|
||||
return document.mapNotNull {
|
||||
val content = it.selectFirst("div.item-img > a") ?: return@mapNotNull null
|
||||
//Log.i(this.name, "Result => $content")
|
||||
val link = fixUrlNull(content.attr("href")) ?: return@mapNotNull null
|
||||
val imgContent = content.select("img")
|
||||
val title = imgContent.attr("alt").cleanTitle()
|
||||
val image = imgContent.attr("src").trim('\'')
|
||||
val year = null
|
||||
//Log.i(this.name, "Result => Title: ${title}, Image: ${image}")
|
||||
|
||||
MovieSearchResponse(
|
||||
name = title,
|
||||
url = link,
|
||||
apiName = this.name,
|
||||
type = globalTvType,
|
||||
posterUrl = image,
|
||||
year = year
|
||||
)
|
||||
}.distinctBy { it.url }
|
||||
return document.toSearchResponse()
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
|
@ -176,7 +125,7 @@ class JavHD : MainAPI() {
|
|||
val innerAImg = it?.select("div.item-img") ?: return@mapNotNull null
|
||||
val aName = it.select("h3 > a").text().cleanTitle()
|
||||
val aImg = innerAImg.select("img").attr("src")
|
||||
val aUrl = innerAImg.select("a").get(0)?.attr("href") ?: return@mapNotNull null
|
||||
val aUrl = innerAImg.select("a").firstOrNull()?.attr("href") ?: return@mapNotNull null
|
||||
MovieSearchResponse(
|
||||
url = aUrl,
|
||||
name = aName,
|
||||
|
@ -195,7 +144,7 @@ class JavHD : MainAPI() {
|
|||
Log.i(this.name, "Result => (vidlink) $vidlink")
|
||||
|
||||
val sceneCount = innerA.text().toIntOrNull()
|
||||
val viddoc = app.get(vidlink).document.getElementsByTag("body").get(0)
|
||||
val viddoc = app.get(vidlink).document.getElementsByTag("body").firstOrNull()
|
||||
val streamEpLink = viddoc?.getValidLinks()?.removeInvalidLinks() ?: ""
|
||||
Episode(
|
||||
name = "Scene $sceneCount",
|
||||
|
@ -294,4 +243,36 @@ class JavHD : MainAPI() {
|
|||
private fun String.cleanTitle(): String =
|
||||
this.trim().removePrefix(prefix).trim()
|
||||
|
||||
private fun Elements.toSearchResponse(): List<SearchResponse> =
|
||||
this.mapNotNull {
|
||||
val content = it.selectFirst("div.item-img > a") ?: return@mapNotNull null
|
||||
//Log.i(this.name, "Result => $content")
|
||||
// Video details
|
||||
val link = fixUrlNull(content.attr("href")) ?: return@mapNotNull null
|
||||
val imgContent = content.select("img")
|
||||
val title = content.attr("title").ifBlank {
|
||||
imgContent.attr("alt")
|
||||
}.cleanTitle()
|
||||
val image = imgContent.attr("src").trim('\'').ifBlank {
|
||||
//Get another image from 'srcset' element
|
||||
content.select("img").attr("srcset")
|
||||
.split("\\s+".toRegex())
|
||||
.firstOrNull { imgItem ->
|
||||
imgItem.trim().startsWith("https")
|
||||
}
|
||||
}
|
||||
val year = null
|
||||
//Log.i(this.name, "Result => Title: ${title}, Image: ${image}")
|
||||
|
||||
MovieSearchResponse(
|
||||
name = title,
|
||||
url = link,
|
||||
apiName = this@JavHD.name,
|
||||
type = globalTvType,
|
||||
posterUrl = image,
|
||||
year = year,
|
||||
id = null
|
||||
)
|
||||
}.distinctBy { it.url }
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 4
|
||||
version = 5
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.lagradost.cloudstream3.MainAPI
|
|||
import com.lagradost.cloudstream3.TvType
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.app
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class JavMost : MainAPI() {
|
||||
private val DEV = "DevDebug"
|
||||
|
@ -21,8 +20,7 @@ class JavMost : MainAPI() {
|
|||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val html = app.get(mainUrl).text
|
||||
val document = Jsoup.parse(html)
|
||||
val document = app.get(mainUrl).document
|
||||
val all = ArrayList<HomePageList>()
|
||||
|
||||
val mainbody = document.getElementsByTag("body")
|
||||
|
@ -37,12 +35,13 @@ class JavMost : MainAPI() {
|
|||
val link = linkA?.firstOrNull()?.attr("href") ?: ""
|
||||
val name = listOfNotNull(linkA?.firstOrNull()?.text(), linkA?.getOrNull(1)?.text()).joinToString(" ")
|
||||
//Log.i(DEV, "Result => (name and link) ${name} / ${link}")
|
||||
var image = inner?.select("center > a > img")?.attr("data-src")
|
||||
if (image == null) {
|
||||
image = inner?.select("center > a > img")?.attr("src")
|
||||
} else {
|
||||
if (image == "http") {
|
||||
image = inner?.select("center > a > img")?.attr("src")
|
||||
val image = inner?.select("center > a > img")?.attr("data-src").orEmpty().ifBlank {
|
||||
inner.select("center > a > img")?.attr("src")
|
||||
}.run {
|
||||
if (this.equals("http")) {
|
||||
inner?.select("center > a > img")?.attr("src")
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
//Log.i(DEV, "Result => (image) ${image}")
|
||||
|
@ -71,8 +70,7 @@ class JavMost : MainAPI() {
|
|||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse>? {
|
||||
val html = app.get("$mainUrl/search/${query}/").text
|
||||
val document = Jsoup.parse(html)
|
||||
val document = app.get("$mainUrl/search/${query}/").document
|
||||
val mainbody = document.getElementsByTag("body")
|
||||
?.select("div#page-container > div#content > div#content-update > div")
|
||||
?.select("div.col-md-4.col-sm-6")
|
||||
|
@ -130,8 +128,7 @@ class JavMost : MainAPI() {
|
|||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val document = app.get(url).document
|
||||
//Log.i(DEV, "Url => ${url}")
|
||||
val body = document.getElementsByTag("head")
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -150,6 +150,18 @@ class JavSubProvider : MainAPI() {
|
|||
//playerIframes.add("$prefixTag$contentUrl")
|
||||
//}
|
||||
//Log.i(this.name, "Result => (contentUrl) $contentUrl")
|
||||
Log.i(this.name, "Result => (playerIframes) ${playerIframes.toJson()}")
|
||||
|
||||
return MovieLoadResponse(
|
||||
name = title,
|
||||
url = url,
|
||||
apiName = this.name,
|
||||
type = globalTvType,
|
||||
dataUrl = playerIframes.toJson(),
|
||||
posterUrl = poster,
|
||||
year = year,
|
||||
plot = descript
|
||||
)
|
||||
}
|
||||
|
||||
Log.i(this.name, "Result => (playerIframes) ${playerIframes.toJson()}")
|
||||
|
|
|
@ -5,9 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
|||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.AppUtils
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
|
@ -174,8 +172,7 @@ class JavTube : MainAPI() {
|
|||
).let { postreq ->
|
||||
Log.i(DEV, "Post => (${postreq.code}) ${postreq.text}")
|
||||
|
||||
val doc = Jsoup.parse(postreq.text)
|
||||
val src = doc.selectFirst("iframe")?.attr("src") ?: ""
|
||||
val src = Jsoup.parse(postreq.text).selectFirst("iframe")?.attr("src") ?: ""
|
||||
Log.i(DEV, "Post Url => $src")
|
||||
|
||||
val id = src.trimEnd('/').split("/").last()
|
||||
|
|
|
@ -179,8 +179,8 @@ class OpJav : MainAPI() {
|
|||
)
|
||||
app.post("$mainUrl/ajax", headers = ajaxHead, data = ajaxData)
|
||||
.document.select("iframe").forEach { iframe ->
|
||||
val serverLink = iframe?.attr("src")?.trim()
|
||||
if (!serverLink.isNullOrBlank()) {
|
||||
val serverLink = iframe?.attr("src")?.trim().orEmpty()
|
||||
if (serverLink.isNotBlank()) {
|
||||
watchlink.add(serverLink)
|
||||
Log.i(this.name, "Result => (serverLink) $serverLink")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue