ktor
This commit is contained in:
parent
605a501496
commit
1f404c5306
|
|
@ -47,6 +47,12 @@ android {
|
||||||
jvmTarget = "11"
|
jvmTarget = "11"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
packagingOptions {
|
||||||
|
|
||||||
|
exclude 'META-INF/*'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
configurations.configureEach {
|
configurations.configureEach {
|
||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
|
|
@ -74,10 +80,15 @@ dependencies {
|
||||||
// Optional -- Mockito framework(可选,用于模拟一些依赖对象,以达到隔离依赖的效果)
|
// Optional -- Mockito framework(可选,用于模拟一些依赖对象,以达到隔离依赖的效果)
|
||||||
testImplementation 'org.mockito:mockito-core:5.12.0'
|
testImplementation 'org.mockito:mockito-core:5.12.0'
|
||||||
testImplementation "org.robolectric:robolectric:4.13"
|
testImplementation "org.robolectric:robolectric:4.13"
|
||||||
testImplementation 'cn.hutool:hutool-all:5.8.26'
|
testImplementation 'cn.hutool:hutool-all:5.8.26'
|
||||||
|
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1"
|
||||||
|
implementation 'io.ktor:ktor-server-core:2.3.4'
|
||||||
|
implementation 'io.ktor:ktor-server-netty:2.3.4'
|
||||||
|
implementation 'io.ktor:ktor-client-content-negotiation:2.3.4'
|
||||||
|
implementation 'io.ktor:ktor-server-content-negotiation:2.3.4'
|
||||||
|
implementation 'io.ktor:ktor-client-logging-jvm:2.3.4'
|
||||||
//implementation 'wang.harlon.quickjs:wrapper-java:1.0.0'
|
//implementation 'wang.harlon.quickjs:wrapper-java:1.0.0'
|
||||||
// implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release')
|
// implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release')
|
||||||
// api 'wang.harlon.quickjs:wrapper-android:2.0.0'
|
// api 'wang.harlon.quickjs:wrapper-android:2.0.0'
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,38 @@
|
||||||
# Please add these rules to your existing keep rules in order to suppress warnings.
|
# Please add these rules to your existing keep rules in order to suppress warnings.
|
||||||
# This is generated automatically by the Android Gradle plugin.
|
# This is generated automatically by the Android Gradle plugin.
|
||||||
-dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider
|
-dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider
|
||||||
|
|
||||||
|
# Please add these rules to your existing keep rules in order to suppress warnings.
|
||||||
|
# This is generated automatically by the Android Gradle plugin.
|
||||||
|
-dontwarn io.netty.internal.tcnative.AsyncSSLPrivateKeyMethod
|
||||||
|
-dontwarn io.netty.internal.tcnative.AsyncTask
|
||||||
|
-dontwarn io.netty.internal.tcnative.Buffer
|
||||||
|
-dontwarn io.netty.internal.tcnative.CertificateCallback
|
||||||
|
-dontwarn io.netty.internal.tcnative.CertificateCompressionAlgo
|
||||||
|
-dontwarn io.netty.internal.tcnative.CertificateVerifier
|
||||||
|
-dontwarn io.netty.internal.tcnative.Library
|
||||||
|
-dontwarn io.netty.internal.tcnative.SSL
|
||||||
|
-dontwarn io.netty.internal.tcnative.SSLContext
|
||||||
|
-dontwarn io.netty.internal.tcnative.SSLPrivateKeyMethod
|
||||||
|
-dontwarn io.netty.internal.tcnative.SSLSessionCache
|
||||||
|
-dontwarn io.netty.internal.tcnative.SessionTicketKey
|
||||||
|
-dontwarn io.netty.internal.tcnative.SniHostNameMatcher
|
||||||
|
-dontwarn java.lang.management.ManagementFactory
|
||||||
|
-dontwarn java.lang.management.RuntimeMXBean
|
||||||
|
-dontwarn org.apache.log4j.Level
|
||||||
|
-dontwarn org.apache.log4j.Logger
|
||||||
|
-dontwarn org.apache.log4j.Priority
|
||||||
|
-dontwarn org.apache.logging.log4j.Level
|
||||||
|
-dontwarn org.apache.logging.log4j.LogManager
|
||||||
|
-dontwarn org.apache.logging.log4j.Logger
|
||||||
|
-dontwarn org.apache.logging.log4j.message.MessageFactory
|
||||||
|
-dontwarn org.apache.logging.log4j.spi.ExtendedLogger
|
||||||
|
-dontwarn org.apache.logging.log4j.spi.ExtendedLoggerWrapper
|
||||||
|
-dontwarn org.conscrypt.BufferAllocator
|
||||||
|
-dontwarn org.conscrypt.Conscrypt
|
||||||
|
-dontwarn org.conscrypt.HandshakeListener
|
||||||
|
-dontwarn org.eclipse.jetty.npn.NextProtoNego$ClientProvider
|
||||||
|
-dontwarn org.eclipse.jetty.npn.NextProtoNego$Provider
|
||||||
|
-dontwarn org.eclipse.jetty.npn.NextProtoNego$ServerProvider
|
||||||
|
-dontwarn org.eclipse.jetty.npn.NextProtoNego
|
||||||
|
-dontwarn reactor.blockhound.integration.BlockHoundIntegration
|
||||||
|
|
@ -25,6 +25,7 @@ import com.github.catvod.net.OkResult;
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.spider.Proxy;
|
import com.github.catvod.spider.Proxy;
|
||||||
import com.github.catvod.utils.Json;
|
import com.github.catvod.utils.Json;
|
||||||
|
import com.github.catvod.utils.KtorServer;
|
||||||
import com.github.catvod.utils.Notify;
|
import com.github.catvod.utils.Notify;
|
||||||
import com.github.catvod.utils.Path;
|
import com.github.catvod.utils.Path;
|
||||||
import com.github.catvod.utils.ProxyVideo;
|
import com.github.catvod.utils.ProxyVideo;
|
||||||
|
|
@ -234,7 +235,7 @@ public class QuarkApi {
|
||||||
Map<String, String> header = getHeaders();
|
Map<String, String> header = getHeaders();
|
||||||
header.remove("Host");
|
header.remove("Host");
|
||||||
header.remove("Content-Type");
|
header.remove("Content-Type");
|
||||||
return Result.get().url(proxyVideoUrl(playUrl, header)).octet().header(header).string();
|
return Result.get().url(KtorServer.INSTANCE.buildProxyUrl(playUrl, header)).octet().header(header).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String proxyVideoUrl(String url, Map<String, String> header) {
|
private String proxyVideoUrl(String url, Map<String, String> header) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
|
import com.github.catvod.utils.KtorServer;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -42,6 +43,8 @@ public class Init {
|
||||||
public static void init(Context context) {
|
public static void init(Context context) {
|
||||||
get().app = ((Application) context);
|
get().app = ((Application) context);
|
||||||
SpiderDebug.log("自定義爬蟲代碼載入成功!"+"1");
|
SpiderDebug.log("自定義爬蟲代碼載入成功!"+"1");
|
||||||
|
KtorServer.INSTANCE.stop();
|
||||||
|
KtorServer.INSTANCE.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void execute(Runnable runnable) {
|
public static void execute(Runnable runnable) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.github.catvod.utils;
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
import com.github.catvod.server.Server;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
|
@ -13,11 +12,13 @@ public class ProxyVideoTest {
|
||||||
@Test
|
@Test
|
||||||
public void proxyMultiThread() {
|
public void proxyMultiThread() {
|
||||||
// ProxyVideo.proxyMultiThread()
|
// ProxyVideo.proxyMultiThread()
|
||||||
Server.get().start();
|
/* Server.get().start();
|
||||||
String url = ProxyVideo.buildCommonProxyUrl(
|
String url = ProxyVideo.buildCommonProxyUrl(
|
||||||
// "https://js.shipin520.com/pc/images/new/banner20250225.mp4", new HashMap<>());
|
// "https://js.shipin520.com/pc/images/new/banner20250225.mp4", new HashMap<>());
|
||||||
"http://172.16.1.217:18089/ng-grid/video.mp4", new HashMap<>());
|
"http://172.16.1.217:18089/ng-grid/video.mp4", new HashMap<>());
|
||||||
System.out.println(url);
|
System.out.println(url);*/
|
||||||
|
KtorServer.INSTANCE.start();
|
||||||
|
System.out.println(KtorServer.INSTANCE.buildProxyUrl("http://172.16.1.217:18089/ng-grid/video.mp4", new HashMap<>()));
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
153fe041f1a364fef8f53545dd52588a
|
a15b1cefe57814873e0dc705eaf67d5d
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;153fe041f1a364fef8f53545dd52588a",
|
"spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;a15b1cefe57814873e0dc705eaf67d5d",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "电视直播",
|
"name": "电视直播",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue