Update debug tool

This commit is contained in:
FongMi 2024-02-02 09:49:06 +08:00
parent a85a745943
commit 07f71ec20f
7 changed files with 148 additions and 15 deletions

View File

@ -47,6 +47,6 @@ dependencies {
implementation 'cn.wanghaomiao:JsoupXpath:2.5.1'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'com.google.zxing:core:3.3.0'
//implementation 'com.orhanobut:logger:2.2.0'
implementation 'com.orhanobut:logger:2.2.0'
implementation 'org.jsoup:jsoup:1.15.3'
}

View File

@ -32,6 +32,9 @@
-keep class okio.** { *; }
-keep class okhttp3.** { *; }
# Logger
-keep class com.orhanobut.logger.** { *; }
# QuickJS
-keep class com.whl.quickjs.** { *; }

View File

@ -2,24 +2,102 @@ package com.github.catvod.debug;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import com.github.catvod.R;
import com.github.catvod.crawler.Spider;
import com.github.catvod.spider.Init;
import com.github.catvod.spider.Yingshiche;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MainActivity extends Activity {
private ExecutorService executor;
private Spider spider;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Logger.addLogAdapter(new AndroidLogAdapter());
Init.init(getApplicationContext());
new Thread(() -> {
try {
Button homeContent = findViewById(R.id.homeContent);
Button homeVideoContent = findViewById(R.id.homeVideoContent);
Button categoryContent = findViewById(R.id.categoryContent);
Button detailContent = findViewById(R.id.detailContent);
Button playerContent = findViewById(R.id.playerContent);
Button searchContent = findViewById(R.id.searchContent);
homeContent.setOnClickListener(view -> executor.execute(this::homeContent));
homeVideoContent.setOnClickListener(view -> executor.execute(this::homeVideoContent));
categoryContent.setOnClickListener(view -> executor.execute(this::categoryContent));
detailContent.setOnClickListener(view -> executor.execute(this::detailContent));
playerContent.setOnClickListener(view -> executor.execute(this::playerContent));
searchContent.setOnClickListener(view -> executor.execute(this::searchContent));
Logger.addLogAdapter(new AndroidLogAdapter());
executor = Executors.newCachedThreadPool();
executor.execute(this::initSpider);
}
} catch (Exception e) {
e.printStackTrace();
}
}).start();
private void initSpider() {
try {
Init.init(getApplicationContext());
spider = new Yingshiche();
spider.init(this, "{}");
} catch (Throwable e) {
e.printStackTrace();
}
}
public void homeContent() {
try {
Logger.t("homeContent").d(spider.homeContent(true));
} catch (Throwable e) {
e.printStackTrace();
}
}
public void homeVideoContent() {
try {
Logger.t("homeVideoContent").d(spider.homeVideoContent());
} catch (Throwable e) {
e.printStackTrace();
}
}
public void categoryContent() {
try {
Logger.t("categoryContent").d(spider.categoryContent("tid", "1", true, new HashMap<>()));
} catch (Throwable e) {
e.printStackTrace();
}
}
public void detailContent() {
try {
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("/voddetail/5553.html")));
} catch (Throwable e) {
e.printStackTrace();
}
}
public void playerContent() {
try {
Logger.t("playerContent").d(spider.playerContent("轉存原畫", "kahf2rw5Uuk+652f55f6943ee2f75d8e4fa590b4ec65fd007f8c", new ArrayList<>()));
} catch (Throwable e) {
e.printStackTrace();
}
}
public void searchContent() {
try {
Logger.t("searchContent").d(spider.searchContent("我的人间烟火", false));
} catch (Throwable e) {
e.printStackTrace();
}
}
}

View File

@ -1,7 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">
android:fillViewport="true">
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<Button
android:id="@+id/homeContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="homeContent"
android:textAllCaps="false" />
<Button
android:id="@+id/homeVideoContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="homeVideoContent"
android:textAllCaps="false" />
<Button
android:id="@+id/categoryContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="categoryContent"
android:textAllCaps="false" />
<Button
android:id="@+id/detailContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="detailContent"
android:textAllCaps="false" />
<Button
android:id="@+id/playerContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="playerContent"
android:textAllCaps="false" />
<Button
android:id="@+id/searchContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="searchContent"
android:textAllCaps="false" />
</LinearLayout>
</ScrollView>

Binary file not shown.

View File

@ -1 +1 @@
a6e70c754f96ee89d1dc455a87f9eae0
73e1be1009c6a267fc30ea51b446e304

View File

@ -11,8 +11,6 @@ rd /s/q "%~dp0\spider.jar\smali\com\github\catvod\js"
if not exist "%~dp0\spider.jar\smali\com\github\catvod\" md "%~dp0\spider.jar\smali\com\github\catvod\"
java -Dfile.encoding=utf-8 -jar "%~dp0\3rd\oss.jar" "%~dp0\Smali_classes"
move "%~dp0\Smali_classes\com\github\catvod\spider" "%~dp0\spider.jar\smali\com\github\catvod\"
move "%~dp0\Smali_classes\com\github\catvod\parser" "%~dp0\spider.jar\smali\com\github\catvod\"
move "%~dp0\Smali_classes\com\github\catvod\js" "%~dp0\spider.jar\smali\com\github\catvod\"