9Anime: Json error fix & http error fix (#1150)
http error depends on how good your network is but with the new js it should be fixed for the most people
This commit is contained in:
@ -5,7 +5,7 @@ ext {
|
||||
extName = '9anime'
|
||||
pkgNameSuffix = 'en.nineanime'
|
||||
extClass = '.NineAnime'
|
||||
extVersionCode = 24
|
||||
extVersionCode = 25
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class JsInterceptor(private val lang: String) : Interceptor {
|
||||
// JavaSrcipt gets the Dub or Sub link of vidstream
|
||||
val jsScript = """
|
||||
(function(){
|
||||
setTimeout(function(){
|
||||
window.onload = (function() {
|
||||
let el = document.querySelector('div[data-type="$lang"] ul li[data-sv-id="41"]');
|
||||
let e = document.createEvent('HTMLEvents');
|
||||
e.initEvent('click',true,true);
|
||||
@ -64,8 +64,8 @@ class JsInterceptor(private val lang: String) : Interceptor {
|
||||
window.android.passPayload(entry.name);
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
})();
|
||||
})();"""
|
||||
|
||||
val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap()
|
||||
|
@ -52,19 +52,28 @@ class JsVizInterceptor(private val embedLink: String) : Interceptor {
|
||||
// JavaSrcipt creates Iframe on vidstream page to bypass iframe-cors and gets the sourceUrl
|
||||
val jsScript = """
|
||||
(function(){
|
||||
const html = '<iframe src="$embedLink" allow="autoplay; fullscreen" allowfullscreen="yes" scrolling="no" style="width: 100%; height: 100%; overflow: hidden;" frameborder="no"></iframe>';
|
||||
const html = '<iframe src="$embedLink" allow="autoplay; fullscreen" allowfullscreen="yes" scrolling="no" style="width: 100%; height: 100%; overflow: hidden;" frameborder="no" onload="handleIframeLoad()"></iframe>';
|
||||
document.body.innerHTML += html;
|
||||
setTimeout(function() {
|
||||
const iframe = document.querySelector('iframe');
|
||||
|
||||
const originalOpen = iframe.contentWindow.XMLHttpRequest.prototype.open;
|
||||
iframe.contentWindow.XMLHttpRequest.prototype.open = function(method, url, async) {
|
||||
if (!url.includes("ping") && !url.includes("/assets/") && !url.includes("thumbnails") && !url.includes("jpg") && !url.includes("m3u8")) {
|
||||
if (url == null) {
|
||||
const entries = iframe.contentWindow.performance.getEntries();
|
||||
entries.forEach((entry) => {
|
||||
if(entry.initiatorType.includes("xmlhttprequest")){
|
||||
if(!entry.name.includes("/ping/") && !entry.name.includes("/assets/")){
|
||||
if (entry.initiatorType.includes("xmlhttprequest")) {
|
||||
if (!entry.name.includes("/ping/") && !entry.name.includes("/assets/") && !entry.name.includes("thumbnails")) {
|
||||
window.android.passPayload(entry.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
window.android.passPayload("https://" + document.domain + "/" + url);
|
||||
}
|
||||
}
|
||||
originalOpen.apply(this, arguments);
|
||||
}
|
||||
})();
|
||||
"""
|
||||
|
||||
|
@ -71,7 +71,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val id = client.newCall(GET(baseUrl + anime.url)).execute().asJsoup().selectFirst("div[data-id]").attr("data-id")
|
||||
val jsVrfInterceptor = client.newBuilder().addInterceptor(JsVrfInterceptor(id, baseUrl)).build()
|
||||
val vrf = jsVrfInterceptor.newCall(GET("$baseUrl/filter")).execute().request.header("url").toString()
|
||||
return GET("$baseUrl/ajax/episode/list/$id?vrf=$vrf", headers = Headers.headersOf("url", anime.url))
|
||||
return GET("$baseUrl/ajax/episode/list/$id?vrf=${java.net.URLEncoder.encode(vrf, "utf-8")}", headers = Headers.headersOf("url", anime.url))
|
||||
}
|
||||
|
||||
private fun <A, B> Iterable<A>.parallelMap(f: suspend (A) -> B): List<B> =
|
||||
@ -128,7 +128,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val ids = episode.url.substringAfter("list/").substringBefore("?vrf")
|
||||
val jsVrfInterceptor = client.newBuilder().addInterceptor(JsVrfInterceptor(ids, baseUrl)).build()
|
||||
val vrf = jsVrfInterceptor.newCall(GET("$baseUrl/filter")).execute().request.header("url").toString()
|
||||
val url = "/ajax/server/list/$ids?vrf=$vrf"
|
||||
val url = "/ajax/server/list/$ids?vrf=${java.net.URLEncoder.encode(vrf, "utf-8")}"
|
||||
val epurl = episode.url.substringAfter("epurl=")
|
||||
return GET(baseUrl + url, headers = Headers.headersOf("url", epurl))
|
||||
}
|
||||
@ -222,7 +222,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||
val jsVrfInterceptor = client.newBuilder().addInterceptor(JsVrfInterceptor(query, baseUrl)).build()
|
||||
val vrf = jsVrfInterceptor.newCall(GET("$baseUrl/filter")).execute().request.header("url").toString()
|
||||
return GET("$baseUrl/filter?keyword=$query&vrf=$vrf&page=$page", headers = Headers.headersOf("Referer", "$baseUrl/"))
|
||||
return GET("$baseUrl/filter?keyword=$query&vrf=${java.net.URLEncoder.encode(vrf, "utf-8")}&page=$page", headers = Headers.headersOf("Referer", "$baseUrl/"))
|
||||
}
|
||||
|
||||
override fun animeDetailsParse(document: Document): SAnime {
|
||||
|
Reference in New Issue
Block a user