sora: added timeout in index

This commit is contained in:
hexated 2023-09-10 17:01:03 +07:00
parent 2f2358d6c1
commit f29605ec95

View file

@ -2000,7 +2000,8 @@ object SoraExtractor : SoraStream() {
"${apiUrl}search", "${apiUrl}search",
data = data, data = data,
headers = passHeaders, headers = passHeaders,
referer = apiUrl referer = apiUrl,
timeout = 120L
).text else app.post( ).text else app.post(
"${apiUrl}search", "${apiUrl}search",
data = data, data = data,
@ -2008,7 +2009,7 @@ object SoraExtractor : SoraStream() {
).text ).text
) )
} else { } else {
app.post("${apiUrl}search", requestBody = body, referer = apiUrl).text app.post("${apiUrl}search", requestBody = body, referer = apiUrl, timeout = 120L).text
} }
val media = if (api in untrimmedIndex) searchIndex( val media = if (api in untrimmedIndex) searchIndex(
title, title,
@ -2031,20 +2032,22 @@ object SoraExtractor : SoraStream() {
"${apiUrl}id2path", "${apiUrl}id2path",
data = pathData, data = pathData,
headers = passHeaders, headers = passHeaders,
referer = apiUrl referer = apiUrl,
timeout = 120L
) )
} else { } else {
app.post( app.post(
"${apiUrl}id2path", data = pathData, referer = apiUrl "${apiUrl}id2path", data = pathData, referer = apiUrl, timeout = 120L
) )
} }
} else { } else {
app.post("${apiUrl}id2path", requestBody = pathBody, referer = apiUrl) app.post("${apiUrl}id2path", requestBody = pathBody, referer = apiUrl, timeout = 120L)
}).text.let { path -> }).text.let { path ->
if (api in ddomainIndex) { if (api in ddomainIndex) {
val worker = app.get( val worker = app.get(
"${fixUrl(path, apiUrl).encodeUrl()}?a=view", "${fixUrl(path, apiUrl).encodeUrl()}?a=view",
referer = if (api in needRefererIndex) apiUrl else "" referer = if (api in needRefererIndex) apiUrl else "",
timeout = 120L
).document.selectFirst("script:containsData(downloaddomain)")?.data() ).document.selectFirst("script:containsData(downloaddomain)")?.data()
?.substringAfter("\"downloaddomain\":\"")?.substringBefore("\",")?.let { ?.substringAfter("\"downloaddomain\":\"")?.substringBefore("\",")?.let {
"$it/0:" "$it/0:"