Ask4movie: Fix stuff (#1220)
This commit is contained in:
@ -6,7 +6,7 @@ ext {
|
||||
extName = 'Ask4Movie'
|
||||
pkgNameSuffix = 'en.ask4movie'
|
||||
extClass = '.Ask4Movie'
|
||||
extVersionCode = 2
|
||||
extVersionCode = 3
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,14 @@ class Ask4Movie : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val bodyString = client.newCall(
|
||||
GET(season.select("div.top-item a").attr("href"))
|
||||
).execute().body!!.string()
|
||||
val episodeUrlList = episodeListFromSeason(bodyString).reversed()
|
||||
val document = Jsoup.parse(bodyString)
|
||||
|
||||
val episodeUrlList = if (document.selectFirst("ul.group-links-list") == null) {
|
||||
episodeListFromSeason(bodyString).reversed()
|
||||
} else {
|
||||
episodeListFromList(document).reversed()
|
||||
}
|
||||
|
||||
for (ep in episodeUrlList) {
|
||||
val episode = SEpisode.create()
|
||||
episode.name = ep.name
|
||||
@ -673,6 +680,18 @@ class Ask4Movie : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
return episodeList
|
||||
}
|
||||
|
||||
private fun episodeListFromList(document: Document): List<EpisodeUrl> {
|
||||
val seasonNumber = document.selectFirst("div.top-bar-video > a.video-title").text()
|
||||
.substringAfterLast("(").substringBeforeLast(")")
|
||||
|
||||
return document.select("ul.group-links-list > li").map {
|
||||
EpisodeUrl(
|
||||
"$seasonNumber Episode ${it.selectFirst("a").text()}",
|
||||
it.selectFirst("a").attr("data-embed-src")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/recloudstream/cloudstream-extensions/blob/master/Ask4Movie/src/main/kotlin/com/lagradost/Ask4MovieProvider.kt
|
||||
private fun episodeListFromSeason(bodyString: String): List<EpisodeUrl> {
|
||||
var soup = Jsoup.parse(bodyString)
|
||||
@ -681,6 +700,7 @@ class Ask4Movie : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val episodeList = mutableListOf<EpisodeUrl>()
|
||||
|
||||
// Get Episodes
|
||||
|
||||
val playlistDoc = client.newCall(GET(iframeUrl)).execute().asJsoup()
|
||||
|
||||
val episodeRegex = Regex("""([^\n\t]+) S(\d+).E(\d+)""")
|
||||
|
@ -19,10 +19,14 @@ data class CaptionElement(
|
||||
class FilemoonExtractor(private val client: OkHttpClient) {
|
||||
fun videoFromUrl(url: String): List<Video> {
|
||||
try {
|
||||
val jsE = client.newCall(GET(url)).execute().asJsoup().selectFirst("script:containsData(eval)").data()
|
||||
val unpacked = client.newCall(GET(url)).execute().asJsoup().select("script:containsData(eval)").map {
|
||||
JsUnpacker(it.data()).unpack().toString()
|
||||
}.first { it.contains("{file:") }
|
||||
|
||||
val subtitleString = JsUnpacker(jsE).unpack().toString().substringAfter("fetch('").substringBefore("').")
|
||||
val subtitleTracks = mutableListOf<Track>()
|
||||
if (unpacked.contains("fetch('")) {
|
||||
val subtitleString = unpacked.substringAfter("fetch('").substringBefore("').")
|
||||
|
||||
try {
|
||||
if (subtitleString.isNotEmpty()) {
|
||||
val subResponse = client.newCall(
|
||||
@ -35,11 +39,26 @@ class FilemoonExtractor(private val client: OkHttpClient) {
|
||||
}
|
||||
}
|
||||
} catch (e: Error) {}
|
||||
}
|
||||
|
||||
val masterUrl = unpacked.substringAfter("{file:\"").substringBefore("\"}")
|
||||
|
||||
val masterUrl = JsUnpacker(jsE).unpack().toString().substringAfter("{file:\"").substringBefore("\"}")
|
||||
val masterPlaylist = client.newCall(GET(masterUrl)).execute().body!!.string()
|
||||
|
||||
val videoList = mutableListOf<Video>()
|
||||
|
||||
val subtitleRegex = Regex("""#EXT-X-MEDIA:TYPE=SUBTITLES.*?NAME="(.*?)".*?URI="(.*?)"""")
|
||||
try {
|
||||
subtitleTracks.addAll(
|
||||
subtitleRegex.findAll(masterPlaylist).map {
|
||||
Track(
|
||||
it.groupValues[2],
|
||||
it.groupValues[1]
|
||||
)
|
||||
}
|
||||
)
|
||||
} catch (e: Error) {}
|
||||
|
||||
masterPlaylist.substringAfter("#EXT-X-STREAM-INF:").split("#EXT-X-STREAM-INF:")
|
||||
.forEach {
|
||||
val quality = "Filemoon:" + it.substringAfter("RESOLUTION=").substringAfter("x").substringBefore(",") + "p "
|
||||
|
Reference in New Issue
Block a user