This commit is contained in:
Horis
2023-12-17 14:36:48 +08:00
parent 70d8b184ad
commit f819202b6d
@@ -343,7 +343,7 @@ class AnalyzeUrl(
if (fetchRecord.frequency > cs.toInt()) {
return@synchronized (nextTime - System.currentTimeMillis()).toInt()
} else {
fetchRecord.frequency = fetchRecord.frequency + 1
fetchRecord.frequency += 1
return@synchronized 0
}
}
@@ -366,7 +366,7 @@ class AnalyzeUrl(
private fun fetchEnd(concurrentRecord: ConcurrentRecord?) {
if (concurrentRecord != null && !concurrentRecord.isConcurrent) {
synchronized(concurrentRecord) {
concurrentRecord.frequency = concurrentRecord.frequency - 1
concurrentRecord.frequency -= 1
}
}
}
@@ -387,7 +387,6 @@ class AnalyzeUrl(
/**
* 访问网站,返回StrResponse
*/
@Throws(ConcurrentException::class)
suspend fun getStrResponseAwait(
jsStr: String? = null,
sourceRegex: String? = null,
@@ -466,7 +465,6 @@ class AnalyzeUrl(
}
@JvmOverloads
@Throws(ConcurrentException::class)
fun getStrResponse(
jsStr: String? = null,
sourceRegex: String? = null,
@@ -480,7 +478,6 @@ class AnalyzeUrl(
/**
* 访问网站,返回Response
*/
@Throws(ConcurrentException::class)
suspend fun getResponseAwait(): Response {
val concurrentRecord = getConcurrentRecord()
try {
@@ -512,7 +509,6 @@ class AnalyzeUrl(
}
}
@Throws(ConcurrentException::class)
fun getResponse(): Response {
return runBlocking {
getResponseAwait()
@@ -520,7 +516,6 @@ class AnalyzeUrl(
}
@Suppress("UnnecessaryVariable")
@Throws(ConcurrentException::class)
private fun getByteArrayIfDataUri(): ByteArray? {
@Suppress("RegExpRedundantEscape")
val dataUriFindResult = dataUriRegex.find(urlNoQuery)
@@ -535,7 +530,6 @@ class AnalyzeUrl(
/**
* 访问网站,返回ByteArray
*/
@Throws(ConcurrentException::class)
suspend fun getByteArrayAwait(): ByteArray {
getByteArrayIfDataUri()?.let {
return it
@@ -552,7 +546,6 @@ class AnalyzeUrl(
/**
* 访问网站,返回InputStream
*/
@Throws(ConcurrentException::class)
suspend fun getInputStreamAwait(): InputStream {
getByteArrayIfDataUri()?.let {
return ByteArrayInputStream(it)
@@ -560,7 +553,6 @@ class AnalyzeUrl(
return getResponseAwait().body!!.byteStream()
}
@Throws(ConcurrentException::class)
fun getInputStream(): InputStream {
return runBlocking {
getInputStreamAwait()