Merge branch 'main' of https://github.com/FongMi/CatVodSpider
This commit is contained in:
commit
360dc3bc6e
|
|
@ -44,6 +44,10 @@ public class Data {
|
||||||
private List<Page> pages;
|
private List<Page> pages;
|
||||||
@SerializedName("dash")
|
@SerializedName("dash")
|
||||||
private Dash dash;
|
private Dash dash;
|
||||||
|
@SerializedName("owner")
|
||||||
|
private Owner owner;
|
||||||
|
@SerializedName("wbi_img")
|
||||||
|
private Wbi wbi;
|
||||||
|
|
||||||
public JsonElement getResult() {
|
public JsonElement getResult() {
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -116,4 +120,12 @@ public class Data {
|
||||||
public Dash getDash() {
|
public Dash getDash() {
|
||||||
return dash == null ? new Dash() : dash;
|
return dash == null ? new Dash() : dash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Owner getOwner() {
|
||||||
|
return owner == null ? new Owner() : owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wbi getWbi() {
|
||||||
|
return wbi == null ? new Wbi() : wbi;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.github.catvod.bean.bili;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Owner {
|
||||||
|
|
||||||
|
@SerializedName("mid")
|
||||||
|
private String mid;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public String getMid() {
|
||||||
|
return TextUtils.isEmpty(mid) ? "" : mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFormat() {
|
||||||
|
return String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", getMid() + "/{pg}", getName(), getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -42,6 +42,8 @@ public class Resp {
|
||||||
private String pic;
|
private String pic;
|
||||||
@SerializedName("duration")
|
@SerializedName("duration")
|
||||||
private String duration;
|
private String duration;
|
||||||
|
@SerializedName("length")
|
||||||
|
private String length;
|
||||||
|
|
||||||
public static List<Result> arrayFrom(JsonElement str) {
|
public static List<Result> arrayFrom(JsonElement str) {
|
||||||
Type listType = new TypeToken<List<Result>>() {}.getType();
|
Type listType = new TypeToken<List<Result>>() {}.getType();
|
||||||
|
|
@ -61,7 +63,11 @@ public class Resp {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDuration() {
|
public String getDuration() {
|
||||||
return TextUtils.isEmpty(duration) ? "" : duration;
|
return TextUtils.isEmpty(duration) ? getLength() : duration.split(":")[0] + "分鐘";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLength() {
|
||||||
|
return TextUtils.isEmpty(length) ? "" : length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPic() {
|
public String getPic() {
|
||||||
|
|
@ -72,8 +78,8 @@ public class Resp {
|
||||||
Vod vod = new Vod();
|
Vod vod = new Vod();
|
||||||
vod.setVodId(getBvId() + "@" + getAid());
|
vod.setVodId(getBvId() + "@" + getAid());
|
||||||
vod.setVodName(Jsoup.parse(getTitle()).text());
|
vod.setVodName(Jsoup.parse(getTitle()).text());
|
||||||
vod.setVodRemarks(getDuration().split(":")[0] + "分鐘");
|
|
||||||
vod.setVodPic(getPic().startsWith("//") ? "https:" + getPic() : getPic());
|
vod.setVodPic(getPic().startsWith("//") ? "https:" + getPic() : getPic());
|
||||||
|
vod.setVodRemarks(getDuration());
|
||||||
return vod;
|
return vod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.github.catvod.bean.bili;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.github.catvod.utils.Utils;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
public class Wbi {
|
||||||
|
|
||||||
|
private final int[] mixinKeyEncTab = new int[]{46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52};
|
||||||
|
|
||||||
|
@SerializedName("img_url")
|
||||||
|
private String imgUrl;
|
||||||
|
@SerializedName("sub_url")
|
||||||
|
private String subUrl;
|
||||||
|
|
||||||
|
public String getImgUrl() {
|
||||||
|
return TextUtils.isEmpty(imgUrl) ? "" : imgUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubUrl() {
|
||||||
|
return TextUtils.isEmpty(subUrl) ? "" : subUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getMixinKey(String imgKey, String subKey) {
|
||||||
|
String s = imgKey + subKey;
|
||||||
|
StringBuilder key = new StringBuilder();
|
||||||
|
for (int i = 0; i < 32; i++) key.append(s.charAt(mixinKeyEncTab[i]));
|
||||||
|
return key.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParam(LinkedHashMap<String, Object> params) {
|
||||||
|
String imgKey = Uri.parse(getImgUrl()).getLastPathSegment().split("\\.")[0];
|
||||||
|
String subKey = Uri.parse(getSubUrl()).getLastPathSegment().split("\\.")[0];
|
||||||
|
String mixinKey = getMixinKey(imgKey, subKey);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
params.put("wts", System.currentTimeMillis() / 1000);
|
||||||
|
for (String key : params.keySet()) sb.append(key).append("=").append(URLEncoder.encode(params.get(key).toString())).append("&");
|
||||||
|
String param = Utils.substring(sb.toString());
|
||||||
|
String wbiSign = Utils.MD5(param + mixinKey);
|
||||||
|
return param + "&w_rid=" + wbiSign;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,9 +13,15 @@ public class Item {
|
||||||
private String url;
|
private String url;
|
||||||
@SerializedName("icon")
|
@SerializedName("icon")
|
||||||
private String icon;
|
private String icon;
|
||||||
|
@SerializedName("copy")
|
||||||
|
private String copy;
|
||||||
@SerializedName("version")
|
@SerializedName("version")
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
|
public Item(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return TextUtils.isEmpty(name) ? "" : name;
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
}
|
}
|
||||||
|
|
@ -28,6 +34,10 @@ public class Item {
|
||||||
return TextUtils.isEmpty(icon) ? "" : icon;
|
return TextUtils.isEmpty(icon) ? "" : icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCopy() {
|
||||||
|
return TextUtils.isEmpty(copy) ? "" : copy;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return TextUtils.isEmpty(version) ? "" : version;
|
return TextUtils.isEmpty(version) ? "" : version;
|
||||||
}
|
}
|
||||||
|
|
@ -35,4 +45,12 @@ public class Item {
|
||||||
public Vod vod() {
|
public Vod vod() {
|
||||||
return new Vod(getUrl(), getName(), getIcon(), getVersion(), Vod.Style.rect(1.0f));
|
return new Vod(getUrl(), getName(), getIcon(), getVersion(), Vod.Style.rect(1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) return true;
|
||||||
|
if (!(obj instanceof Item)) return false;
|
||||||
|
Item it = (Item) obj;
|
||||||
|
return getUrl().equals(it.getUrl());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,15 +113,23 @@ public class Bili extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
String order = extend.containsKey("order") ? extend.get("order") : "totalrank";
|
if (tid.endsWith("/{pg}")) {
|
||||||
String duration = extend.containsKey("duration") ? extend.get("duration") : "0";
|
String mid = tid.split("/")[0];
|
||||||
if (extend.containsKey("tid")) tid = tid + " " + extend.get("tid");
|
List<Vod> list = new ArrayList<>();
|
||||||
String api = "https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword=" + URLEncoder.encode(tid) + "&order=" + order + "&duration=" + duration + "&page=" + pg;
|
String json = OkHttp.string("https://api.bilibili.com/x/space/wbi/arc/search?mid=" + mid + "&pn=" + pg, getHeader());
|
||||||
String json = OkHttp.string(api, getHeader());
|
for (Resp.Result item : Resp.Result.arrayFrom(Resp.objectFrom(json).getData().getList().getAsJsonObject().get("vlist"))) list.add(item.getVod());
|
||||||
Resp resp = Resp.objectFrom(json);
|
return Result.string(list);
|
||||||
List<Vod> list = new ArrayList<>();
|
} else {
|
||||||
for (Resp.Result item : Resp.Result.arrayFrom(resp.getData().getResult())) list.add(item.getVod());
|
String order = extend.containsKey("order") ? extend.get("order") : "totalrank";
|
||||||
return Result.string(list);
|
String duration = extend.containsKey("duration") ? extend.get("duration") : "0";
|
||||||
|
if (extend.containsKey("tid")) tid = tid + " " + extend.get("tid");
|
||||||
|
String api = "https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword=" + URLEncoder.encode(tid) + "&order=" + order + "&duration=" + duration + "&page=" + pg;
|
||||||
|
String json = OkHttp.string(api, getHeader());
|
||||||
|
Resp resp = Resp.objectFrom(json);
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Resp.Result item : Resp.Result.arrayFrom(resp.getData().getResult())) list.add(item.getVod());
|
||||||
|
return Result.string(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -141,6 +149,7 @@ public class Bili extends Spider {
|
||||||
vod.setVodName(detail.getTitle());
|
vod.setVodName(detail.getTitle());
|
||||||
vod.setTypeName(detail.getType());
|
vod.setTypeName(detail.getType());
|
||||||
vod.setVodContent(detail.getDesc());
|
vod.setVodContent(detail.getDesc());
|
||||||
|
vod.setVodDirector(detail.getOwner().getFormat());
|
||||||
vod.setVodRemarks(detail.getDuration() / 60 + "分鐘");
|
vod.setVodRemarks(detail.getDuration() / 60 + "分鐘");
|
||||||
|
|
||||||
List<String> acceptDesc = new ArrayList<>();
|
List<String> acceptDesc = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.github.catvod.bean.Class;
|
||||||
import com.github.catvod.bean.Result;
|
import com.github.catvod.bean.Result;
|
||||||
import com.github.catvod.bean.Vod;
|
import com.github.catvod.bean.Vod;
|
||||||
import com.github.catvod.bean.market.Data;
|
import com.github.catvod.bean.market.Data;
|
||||||
|
import com.github.catvod.bean.market.Item;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.FileUtil;
|
import com.github.catvod.utils.FileUtil;
|
||||||
|
|
@ -100,6 +101,7 @@ public class Market extends Spider {
|
||||||
if (file.getName().endsWith(".zip")) FileUtil.unzip(file, Path.download());
|
if (file.getName().endsWith(".zip")) FileUtil.unzip(file, Path.download());
|
||||||
if (file.getName().endsWith(".apk")) FileUtil.openFile(Path.chmod(file));
|
if (file.getName().endsWith(".apk")) FileUtil.openFile(Path.chmod(file));
|
||||||
else Utils.notify("下載完成");
|
else Utils.notify("下載完成");
|
||||||
|
checkCopy(url);
|
||||||
dismiss();
|
dismiss();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Utils.notify(e.getMessage());
|
Utils.notify(e.getMessage());
|
||||||
|
|
@ -121,6 +123,16 @@ public class Market extends Spider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkCopy(String url) {
|
||||||
|
for (Data data : datas) {
|
||||||
|
int index = data.getList().indexOf(new Item(url));
|
||||||
|
if (index == -1) continue;
|
||||||
|
String text = data.getList().get(index).getCopy();
|
||||||
|
if (!text.isEmpty()) Utils.copy(text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setDialog() {
|
private void setDialog() {
|
||||||
Init.run(() -> {
|
Init.run(() -> {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.github.catvod.utils;
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
|
@ -152,6 +155,12 @@ public class Utils {
|
||||||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getDisplayMetrics());
|
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getDisplayMetrics());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void copy(String text) {
|
||||||
|
ClipboardManager manager = (ClipboardManager) Init.context().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
manager.setPrimaryClip(ClipData.newPlainText("fongmi", text));
|
||||||
|
notify("已複製 " + text);
|
||||||
|
}
|
||||||
|
|
||||||
public static void loadUrl(WebView webView, String script) {
|
public static void loadUrl(WebView webView, String script) {
|
||||||
loadUrl(webView, script, null);
|
loadUrl(webView, script, null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
9cc15b83a755468e6b725667ef362a04
|
386aa45681818befd51ff5008f88f4e5
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;9cc15b83a755468e6b725667ef362a04",
|
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;386aa45681818befd51ff5008f88f4e5",
|
||||||
"wallpaper": "https://gao.chuqiuyu.tk",
|
"wallpaper": "https://gao.chuqiuyu.tk",
|
||||||
"sites": [
|
"sites": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;9cc15b83a755468e6b725667ef362a04",
|
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;386aa45681818befd51ff5008f88f4e5",
|
||||||
"wallpaper": "http://饭太硬.top/深色壁纸/api.php",
|
"wallpaper": "http://饭太硬.top/深色壁纸/api.php",
|
||||||
"sites": [
|
"sites": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -210,12 +210,14 @@
|
||||||
{
|
{
|
||||||
"name": "watson",
|
"name": "watson",
|
||||||
"url": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/zip/js-1019.zip",
|
"url": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/zip/js-1019.zip",
|
||||||
"icon": "https://i.imgs.ovh/2023/10/20/2I7XH.jpeg"
|
"icon": "https://i.imgs.ovh/2023/10/20/2I7XH.jpeg",
|
||||||
|
"copy": "file://Download/JS/js.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "香雅情",
|
"name": "香雅情",
|
||||||
"url": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/zip/XYQTVBox_本地包.zip",
|
"url": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/zip/XYQTVBox_本地包.zip",
|
||||||
"icon": "https://i.imgs.ovh/2023/10/20/2IO0D.jpeg"
|
"icon": "https://i.imgs.ovh/2023/10/20/2IO0D.jpeg",
|
||||||
|
"copy": "file://Download/XYQTVBox/XYQTVBox.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue