Update jar

This commit is contained in:
FongMi 2023-05-25 21:23:25 +08:00
parent a0182d8625
commit fccb62d029
3 changed files with 23 additions and 26 deletions

View File

@ -33,7 +33,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author ColaMint & FongMi
* @author ColaMint & FongMi & 唐三
*/
public class Bili extends Spider {
@ -47,11 +47,8 @@ public class Bili extends Spider {
private String getCookie() {
String cache = Prefers.getString("BiliCookie");
if (!TextUtils.isEmpty(cache)) return cache;
if (!ext.optString("cookie").isEmpty()) {
if (ext.optString("cookie").startsWith("http")) return OkHttp.string(ext.optString("cookie")).replace("\n", "").trim();
return ext.optString("cookie");
}
return "buvid3=84B0395D-C9F2-C490-E92E-A09AB48FE26E71636infoc";
if (ext.optString("cookie").startsWith("http")) return OkHttp.string(ext.optString("cookie")).replace("\n", "").trim();
return ext.optString("cookie", "buvid3=84B0395D-C9F2-C490-E92E-A09AB48FE26E71636infoc");
}
private void setHeader() {
@ -60,27 +57,27 @@ public class Bili extends Spider {
header.put("User-Agent", Utils.CHROME);
}
private void generate() throws Exception {
ext = new JSONObject();
JSONArray classes = new JSONArray();
JSONObject filters = new JSONObject();
ext.put("classes", classes);
ext.put("filter", filters);
JSONArray filter = new JSONArray("[{\"key\":\"order\",\"name\":\"排序\",\"value\":[{\"n\":\"综合排序\",\"v\":\"0\"},{\"n\":\"最多点击\",\"v\":\"click\"},{\"n\":\"最新发布\",\"v\":\"pubdate\"},{\"n\":\"最多弹幕\",\"v\":\"dm\"},{\"n\":\"最多收藏\",\"v\":\"stow\"}]},{\"key\":\"duration\",\"name\":\"时长\",\"value\":[{\"n\":\"全部时长\",\"v\":\"0\"},{\"n\":\"60分钟以上\",\"v\":\"4\"},{\"n\":\"30~60分钟\",\"v\":\"3\"},{\"n\":\"10~30分钟\",\"v\":\"2\"},{\"n\":\"10分钟以下\",\"v\":\"1\"}]}]");
String[] types = extend.split("#");
for (String type : types) {
JSONObject c = new JSONObject();
c.put("type_name", type);
c.put("type_id", type);
filters.put(type, filter);
classes.put(c);
}
}
private void fetchRule() throws Exception {
if (header.containsKey("cookie") && header.get("cookie").length() > 0) return;
if (extend.startsWith("http")) {
extend = OkHttp.string(extend);
ext = new JSONObject(extend);
} else {
JSONArray newFilter = new JSONArray("[{\"key\":\"order\",\"name\":\"排序\",\"value\":[{\"n\":\"综合排序\",\"v\":\"0\"},{\"n\":\"最多点击\",\"v\":\"click\"},{\"n\":\"最新发布\",\"v\":\"pubdate\"},{\"n\":\"最多弹幕\",\"v\":\"dm\"},{\"n\":\"最多收藏\",\"v\":\"stow\"}]},{\"key\":\"duration\",\"name\":\"时长\",\"value\":[{\"n\":\"全部时长\",\"v\":\"0\"},{\"n\":\"60分钟以上\",\"v\":\"4\"},{\"n\":\"30~60分钟\",\"v\":\"3\"},{\"n\":\"10~30分钟\",\"v\":\"2\"},{\"n\":\"10分钟以下\",\"v\":\"1\"}]}]");
String[] typeC = extend.split("#");
JSONArray classes = new JSONArray();
JSONObject filters = new JSONObject();
for (String kk : typeC) {
JSONObject c = new JSONObject();
c.put("type_name", kk);
c.put("type_id", kk);
classes.put(c);
filters.put(kk, newFilter);
}
ext = new JSONObject();
ext.put("classes", classes);
ext.put("filter", filters);
}
if (extend.startsWith("http")) ext = new JSONObject(extend = OkHttp.string(extend));
else generate();
setHeader();
}

Binary file not shown.

View File

@ -1 +1 @@
af37ed94ebfb6af49a33d48a6fe005da
c57209d88a3ae109cfdb505aa864302c