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