Update
This commit is contained in:
parent
07c0b7b09b
commit
9922c3060a
|
|
@ -8,7 +8,6 @@ import android.os.Looper;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
import com.github.catvod.utils.Notice;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
|
@ -41,7 +40,6 @@ public class Init {
|
|||
public static void init(Context context) {
|
||||
get().app = ((Application) context);
|
||||
SpiderDebug.log("自定義爬蟲代碼載入成功!");
|
||||
Notice.show("https://raw.githubusercontent.com/FongMi/CatVodSpider/main/json/notice.json");
|
||||
}
|
||||
|
||||
public static void execute(Runnable runnable) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package com.github.catvod.utils;
|
||||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.spider.Init;
|
||||
import com.github.catvod.ui.ScrollTextView;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
|
@ -16,29 +18,39 @@ import java.util.Date;
|
|||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
public class Notice {
|
||||
public class Notice extends Spider {
|
||||
|
||||
private static final String SPACE = " ";
|
||||
private ScrollTextView view;
|
||||
private String extend;
|
||||
private int duration;
|
||||
private String msg;
|
||||
|
||||
public static void show(String url) {
|
||||
new Notice().init(url);
|
||||
public static void show(String extend) {
|
||||
try {
|
||||
Notice notice = new Notice();
|
||||
notice.init(null, extend);
|
||||
notice.homeContent(false);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void init(String url) {
|
||||
try {
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
this.extend = extend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault());
|
||||
String json = OkHttp.string(url);
|
||||
String json = OkHttp.string(extend);
|
||||
JSONObject object = new JSONObject(json);
|
||||
msg = object.optString("msg");
|
||||
duration = object.optInt("duration", 30);
|
||||
String date = object.optString("date");
|
||||
boolean show = msg.length() > 0 && (date.isEmpty() || new Date().after(sdf.parse(date)));
|
||||
if (show) Init.run(this::createView);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void createView() {
|
||||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
388b76449e755e157bf0812c5621bd78
|
||||
4698f64899d582ca9986f8c45564dd38
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;388b76449e755e157bf0812c5621bd78",
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;4698f64899d582ca9986f8c45564dd38",
|
||||
"wallpaper": "https://gao.chuqiuyu.tk",
|
||||
"sites": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;388b76449e755e157bf0812c5621bd78",
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;4698f64899d582ca9986f8c45564dd38",
|
||||
"wallpaper": "http://饭太硬.ga/深色壁纸/api.php",
|
||||
"sites": [
|
||||
{
|
||||
|
|
@ -226,6 +226,15 @@
|
|||
"api": "csp_Push",
|
||||
"searchable": 1,
|
||||
"changeable": 0
|
||||
},
|
||||
{
|
||||
"key": "公告",
|
||||
"name": "公告",
|
||||
"type": 3,
|
||||
"api": "csp_Notice",
|
||||
"searchable": 0,
|
||||
"changeable": 0,
|
||||
"ext": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/json/notice.json"
|
||||
}
|
||||
],
|
||||
"doh": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue