kt携程版本
This commit is contained in:
parent
3b5d167662
commit
bcaa6f18bd
|
|
@ -15,6 +15,8 @@ import kotlinx.coroutines.joinAll
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.PipedInputStream
|
import java.io.PipedInputStream
|
||||||
import java.io.PipedOutputStream
|
import java.io.PipedOutputStream
|
||||||
import java.io.SequenceInputStream
|
import java.io.SequenceInputStream
|
||||||
|
|
@ -104,8 +106,8 @@ object DownloadMT {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val pipedOutputStream = PipedOutputStream();
|
val outputStream = ByteArrayOutputStream();
|
||||||
val pipedInputStream = PipedInputStream(pipedOutputStream);
|
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Default).launch {
|
CoroutineScope(Dispatchers.Default).launch {
|
||||||
repeat(jobs.size) { index ->
|
repeat(jobs.size) { index ->
|
||||||
|
|
@ -113,7 +115,7 @@ object DownloadMT {
|
||||||
for (bytes in channels[index]) {
|
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 contentType:$contentType")
|
||||||
// SpiderDebug.log("++proxy res body:" + response.body());
|
// SpiderDebug.log("++proxy res body:" + response.body());
|
||||||
SpiderDebug.log("----proxy res respHeaders:" + Json.toJson(resHeader))
|
SpiderDebug.log("----proxy res respHeaders:" + Json.toJson(resHeader))
|
||||||
|
val pipedInputStream = ByteArrayInputStream(outputStream.toByteArray());
|
||||||
return arrayOf(206, contentType, pipedInputStream, resHeader)
|
return arrayOf(206, contentType, pipedInputStream, resHeader)
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
5d15267585bfbf43cb2c42f484075de6
|
59ca6e1cbed916f663fb3d0db2114517
|
||||||
|
|
|
||||||
|
|
@ -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": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "电视直播",
|
"name": "电视直播",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue