diff --git a/app/src/main/java/com/github/catvod/utils/DownloadMT.kt b/app/src/main/java/com/github/catvod/utils/DownloadMT.kt index f216f04c..2aa9badd 100644 --- a/app/src/main/java/com/github/catvod/utils/DownloadMT.kt +++ b/app/src/main/java/com/github/catvod/utils/DownloadMT.kt @@ -15,6 +15,8 @@ import kotlinx.coroutines.joinAll import kotlinx.coroutines.launch import okhttp3.Response import org.apache.commons.lang3.StringUtils +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream import java.io.PipedInputStream import java.io.PipedOutputStream import java.io.SequenceInputStream @@ -104,8 +106,8 @@ object DownloadMT { } } - val pipedOutputStream = PipedOutputStream(); - val pipedInputStream = PipedInputStream(pipedOutputStream); + val outputStream = ByteArrayOutputStream(); + CoroutineScope(Dispatchers.Default).launch { repeat(jobs.size) { index -> @@ -113,7 +115,7 @@ object DownloadMT { for (bytes in channels[index]) { // 处理读取的数据 - pipedOutputStream.write(bytes); + outputStream.write(bytes); } @@ -148,7 +150,7 @@ object DownloadMT { SpiderDebug.log("----proxy res contentType:$contentType") // SpiderDebug.log("++proxy res body:" + response.body()); SpiderDebug.log("----proxy res respHeaders:" + Json.toJson(resHeader)) - + val pipedInputStream = ByteArrayInputStream(outputStream.toByteArray()); return arrayOf(206, contentType, pipedInputStream, resHeader) } catch (e: Exception) { diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 704e23aa..e05938f9 100644 Binary files a/jar/custom_spider.jar and b/jar/custom_spider.jar differ diff --git a/jar/custom_spider.jar.md5 b/jar/custom_spider.jar.md5 index 38913075..4675cdc5 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -5d15267585bfbf43cb2c42f484075de6 +59ca6e1cbed916f663fb3d0db2114517 diff --git a/json/test.json b/json/test.json index 463f2d96..ab030057 100644 --- a/json/test.json +++ b/json/test.json @@ -1,5 +1,5 @@ { - "spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;5d15267585bfbf43cb2c42f484075de6", + "spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;59ca6e1cbed916f663fb3d0db2114517", "lives": [ { "name": "电视直播",