Merge branch 'main' of github.com:oiltea/CatVodSpider

This commit is contained in:
Oiltea 2023-08-29 15:53:09 +08:00
commit 1d9f219f85
11 changed files with 102 additions and 216 deletions

View File

@ -58,12 +58,10 @@ public class AliYun {
private final List<String> tempIds;
private AlertDialog dialog;
private String refreshToken;
private String shareToken;
private String shareId;
private String driveId;
private Share share;
private OAuth oauth;
private User user;
private Drive drive;
private User user;
private static class Loader {
static volatile AliYun INSTANCE = new AliYun();
@ -87,8 +85,8 @@ public class AliYun {
private AliYun() {
tempIds = new ArrayList<>();
oauth = OAuth.objectFrom(FileUtil.read(getOAuthCache()));
user = User.objectFrom(FileUtil.read(getUserCache()));
oauth = OAuth.objectFrom(FileUtil.read(getOAuthCache()));
drive = Drive.objectFrom(FileUtil.read(getDriveCache()));
}
@ -104,14 +102,6 @@ public class AliYun {
return result;
}
public void setShareId(String shareId) {
if (!getOAuthCache().exists()) oauth.clean().save();
if (!getUserCache().exists()) user.clean().save();
if (!getDriveCache().exists()) drive.clean().save();
this.shareId = shareId;
refreshShareToken();
}
public HashMap<String, String> getHeader() {
HashMap<String, String> headers = new HashMap<>();
headers.put("User-Agent", Utils.CHROME);
@ -121,7 +111,7 @@ public class AliYun {
private HashMap<String, String> getHeaderAuth() {
HashMap<String, String> headers = getHeader();
headers.put("x-share-token", shareToken);
headers.put("x-share-token", share.getShareToken());
headers.put("X-Canary", "client=Android,app=adrive,version=v4.3.1");
if (user.isAuthed()) headers.put("authorization", user.getAuthorization());
return headers;
@ -153,7 +143,7 @@ public class AliYun {
url = url.startsWith("https") ? url : "https://api.aliyundrive.com/" + url;
OkResult result = OkHttp.postJson(url, json, getHeaderAuth());
SpiderDebug.log(result.getCode() + "," + url + "," + result.getBody());
if (retry && (result.getCode() == 400 || result.getCode() == 401) && refreshAccessToken()) return auth(url, json, false);
if (retry && result.getCode() == 401 && refreshAccessToken()) return auth(url, json, false);
if (retry && result.getCode() == 429) return auth(url, json, false);
return result.getBody();
}
@ -178,14 +168,15 @@ public class AliYun {
return false;
}
private void refreshShareToken() {
private void refreshShareToken(String shareId) {
if (share != null && share.alive(shareId)) return;
SpiderDebug.log("refreshShareToken...");
JsonObject param = new JsonObject();
param.addProperty("share_id", shareId);
param.addProperty("share_pwd", "");
String json = post("v2/share_link/get_share_token", param);
shareToken = Share.objectFrom(json).getShareToken();
if (shareToken.isEmpty()) Utils.notify("來晚啦,該分享已失效。");
share = Share.objectFrom(json).setShareId(shareId).setTime();
if (share.getShareToken().isEmpty()) Utils.notify("來晚啦,該分享已失效。");
}
private boolean refreshAccessToken() {
@ -194,7 +185,7 @@ public class AliYun {
JsonObject param = new JsonObject();
String token = user.getRefreshToken();
if (token.isEmpty()) token = refreshToken;
if (token.startsWith("http")) token = OkHttp.string(token).trim();
if (token != null && token.startsWith("http")) token = OkHttp.string(token).trim();
param.addProperty("refresh_token", token);
param.addProperty("grant_type", "refresh_token");
String json = post("https://auth.aliyundrive.com/v2/account/token", param);
@ -214,10 +205,9 @@ public class AliYun {
}
private void getDriveId() {
SpiderDebug.log("Obtain drive id...");
String result = auth("https://user.aliyundrive.com/v2/user/get", "{}", false);
drive = Drive.objectFrom(result).save();
driveId = drive.getResourceDriveId().isEmpty() ? drive.getDriveId() : drive.getResourceDriveId();
SpiderDebug.log("Get Drive Id...");
String json = auth("https://user.aliyundrive.com/v2/user/get", "{}", true);
drive = Drive.objectFrom(json).save();
}
private boolean oauthRequest() {
@ -247,18 +237,19 @@ public class AliYun {
return alist("token", param);
}
public Vod getVod(String url, String fileId) {
public Vod getVod(String url, String shareId, String fileId) {
refreshShareToken(shareId);
JsonObject param = new JsonObject();
param.addProperty("share_id", shareId);
Share share = Share.objectFrom(post("adrive/v3/share_link/get_share_by_anonymous", param));
List<Item> files = new ArrayList<>();
List<Item> subs = new ArrayList<>();
listFiles(new Item(getParentFileId(fileId, share)), files, subs);
listFiles(shareId, new Item(getParentFileId(fileId, share)), files, subs);
Collections.sort(files);
List<String> playFrom = Arrays.asList("原畫", "普畫");
List<String> episode = new ArrayList<>();
List<String> playUrl = new ArrayList<>();
for (Item file : files) episode.add(file.getDisplayName() + "$" + shareId + "@" + file.getFileId() + findSubs(file.getName(), subs));
for (Item file : files) episode.add(file.getDisplayName() + "$" + shareId + "+" + file.getFileId() + findSubs(file.getName(), subs));
for (int i = 0; i < playFrom.size(); i++) playUrl.add(TextUtils.join("#", episode));
Vod vod = new Vod();
vod.setVodId(url);
@ -271,11 +262,11 @@ public class AliYun {
return vod;
}
private void listFiles(Item folder, List<Item> files, List<Item> subs) {
listFiles(folder, files, subs, "");
private void listFiles(String shareId, Item folder, List<Item> files, List<Item> subs) {
listFiles(shareId, folder, files, subs, "");
}
private void listFiles(Item parent, List<Item> files, List<Item> subs, String marker) {
private void listFiles(String shareId, Item parent, List<Item> files, List<Item> subs, String marker) {
List<Item> folders = new ArrayList<>();
JsonObject param = new JsonObject();
param.addProperty("limit", 200);
@ -295,10 +286,10 @@ public class AliYun {
}
}
if (item.getNextMarker().length() > 0) {
listFiles(parent, files, subs, item.getNextMarker());
listFiles(shareId, parent, files, subs, item.getNextMarker());
}
for (Item folder : folders) {
listFiles(folder, files, subs);
listFiles(shareId, folder, files, subs);
}
}
@ -332,20 +323,20 @@ public class AliYun {
String[] split = text.split("@@@");
String name = split[0];
String ext = split[1];
String url = Proxy.getUrl() + "?do=ali&type=sub&file_id=" + split[2];
String url = Proxy.getUrl() + "?do=ali&type=sub&shareId=" + ids[0] + "&fileId=" + split[2];
sub.add(Sub.create().name(name).ext(ext).url(url));
}
return sub;
}
public String getDownloadUrl(String fileId) {
public String getDownloadUrl(String shareId, String fileId) {
try {
getDriveId();
refreshShareToken(shareId);
SpiderDebug.log("getDownloadUrl..." + fileId);
tempIds.add(0, copy(fileId, true));
tempIds.add(0, copy(shareId, fileId));
JsonObject param = new JsonObject();
param.addProperty("file_id", tempIds.get(0));
param.addProperty("drive_id", driveId);
param.addProperty("drive_id", drive.getDriveId());
String json = oauth("openFile/getDownloadUrl", param.toString(), true);
return Download.objectFrom(json).getUrl();
} catch (Exception e) {
@ -356,14 +347,14 @@ public class AliYun {
}
}
public Preview.Info getVideoPreviewPlayInfo(String fileId) {
public Preview.Info getVideoPreviewPlayInfo(String shareId, String fileId) {
try {
getDriveId();
refreshShareToken(shareId);
SpiderDebug.log("getVideoPreviewPlayInfo..." + fileId);
tempIds.add(0, copy(fileId, true));
tempIds.add(0, copy(shareId, fileId));
JsonObject param = new JsonObject();
param.addProperty("file_id", tempIds.get(0));
param.addProperty("drive_id", driveId);
param.addProperty("drive_id", drive.getDriveId());
param.addProperty("category", "live_transcoding");
param.addProperty("url_expire_sec", "14400");
String json = oauth("openFile/getVideoPreviewPlayInfo", param.toString(), true);
@ -377,12 +368,12 @@ public class AliYun {
}
public String playerContent(String[] ids, boolean original) {
if (original) return Result.get().url(getDownloadUrl(ids[0])).octet().subs(getSubs(ids)).header(getHeader()).string();
if (original) return Result.get().url(getDownloadUrl(ids[0], ids[1])).octet().subs(getSubs(ids)).header(getHeader()).string();
else return getPreviewContent(ids);
}
private String getPreviewContent(String[] ids) {
Preview.Info info = getVideoPreviewPlayInfo(ids[0]);
Preview.Info info = getVideoPreviewPlayInfo(ids[0], ids[1]);
List<String> url = getPreviewUrl(info);
List<Sub> subs = getSubs(ids);
subs.addAll(getSubs(info));
@ -405,14 +396,12 @@ public class AliYun {
return subs;
}
private String copy(String fileId, boolean retry) throws Exception {
private String copy(String shareId, String fileId) {
if (drive.getDriveId().isEmpty()) getDriveId();
SpiderDebug.log("Copy..." + fileId);
String json = "{\"requests\":[{\"body\":{\"file_id\":\"%s\",\"share_id\":\"%s\",\"auto_rename\":true,\"to_parent_file_id\":\"root\",\"to_drive_id\":\"%s\"},\"headers\":{\"Content-Type\":\"application/json\"},\"id\":\"0\",\"method\":\"POST\",\"url\":\"/file/copy\"}],\"resource\":\"file\"}";
json = String.format(json, fileId, shareId, driveId);
json = String.format(json, fileId, shareId, drive.getDriveId());
Res res = Res.objectFrom(auth("adrive/v2/batch", json, true));
if (res.getResponse().getStatus() == 403 && retry) refreshShareToken();
if (res.getResponse().getStatus() == 403 && retry) copy(fileId, false);
if (res.getResponse().getStatus() == 403 && !retry) throw new Exception(res.getResponse().getBody().getMessage());
return res.getResponse().getBody().getFileId();
}
@ -427,14 +416,15 @@ public class AliYun {
private boolean delete(String fileId) {
SpiderDebug.log("Delete..." + fileId);
String json = "{\"requests\":[{\"body\":{\"drive_id\":\"%s\",\"file_id\":\"%s\"},\"headers\":{\"Content-Type\":\"application/json\"},\"id\":\"%s\",\"method\":\"POST\",\"url\":\"/file/delete\"}],\"resource\":\"file\"}";
json = String.format(json, driveId, fileId, fileId);
json = String.format(json, drive.getDriveId(), fileId, fileId);
Res res = Res.objectFrom(auth("adrive/v2/batch", json, true));
return res.getResponse().getStatus() == 404;
}
public Object[] proxySub(Map<String, String> params) throws Exception {
String fileId = params.get("file_id");
Response res = OkHttp.newCall(getDownloadUrl(fileId), getHeaderAuth());
String fileId = params.get("fileId");
String shareId = params.get("shareId");
Response res = OkHttp.newCall(getDownloadUrl(shareId, fileId), getHeaderAuth());
byte[] body = Utils.toUtf8(res.body().bytes());
Object[] result = new Object[3];
result[0] = 200;

View File

@ -10,43 +10,29 @@ import com.google.gson.annotations.SerializedName;
public class Drive {
@SerializedName("default_drive_id")
private String driveId;
@SerializedName("user_id")
private String userId;
@SerializedName("backup_drive_id")
private String backupDriveId;
private String defaultDriveId;
@SerializedName("resource_drive_id")
private String resourceDriveId;
@SerializedName("sbox_drive_id")
private String sboxDriveId;
public static Drive objectFrom(String str) {
Drive item = new Gson().fromJson(str, Drive.class);
return item == null ? new Drive() : item;
}
public String getDriveId() {
return TextUtils.isEmpty(driveId) ? "" : driveId;
private String getDefaultDriveId() {
return TextUtils.isEmpty(defaultDriveId) ? "" : defaultDriveId;
}
public String getUserId() {
return TextUtils.isEmpty(userId) ? "" : userId;
}
public String getBackupDriveId() {
return TextUtils.isEmpty(backupDriveId) ? "" : backupDriveId;
}
public String getResourceDriveId() {
private String getResourceDriveId() {
return TextUtils.isEmpty(resourceDriveId) ? "" : resourceDriveId;
}
public String getSboxDriveId() {
return TextUtils.isEmpty(sboxDriveId) ? "" : sboxDriveId;
public String getDriveId() {
return getResourceDriveId().isEmpty() ? getDefaultDriveId() : getResourceDriveId();
}
public Drive clean() {
this.driveId = "";
this.defaultDriveId = "";
this.resourceDriveId = "";
return this;
}

View File

@ -1,7 +1,7 @@
package com.github.catvod.bean.ali;
import android.text.TextUtils;
import com.github.catvod.utils.ChineseComparator;
import com.github.catvod.utils.Utils;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
@ -85,9 +85,13 @@ public class Item implements Comparable<Item> {
public String getDisplayName() {
return TextUtils.join(" ", Arrays.asList(getParent(), getName(), getSize())).trim();
}
public String getSortName() {
return TextUtils.join(" ", Arrays.asList(getParent(), getName())).trim();
}
@Override
public int compareTo(Item item) {
return ChineseComparator.compare(this.getDisplayName(), item.getDisplayName());
return Integer.compare(Utils.getDigit(getSortName()), Utils.getDigit(item.getSortName()));
}
}

View File

@ -10,6 +10,8 @@ import java.util.List;
public class Share {
@SerializedName("share_id")
private String shareId;
@SerializedName("share_token")
private String shareToken;
@SerializedName("expire_time")
@ -42,10 +44,16 @@ public class Share {
@SerializedName("file_infos")
private List<Item> fileInfos;
private long time;
public static Share objectFrom(String str) {
return new Gson().fromJson(str, Share.class);
}
public String getShareId() {
return TextUtils.isEmpty(shareId) ? "" : shareId;
}
public String getShareToken() {
return TextUtils.isEmpty(shareToken) ? "" : shareToken;
}
@ -105,4 +113,18 @@ public class Share {
public List<Item> getFileInfos() {
return fileInfos == null ? Collections.emptyList() : fileInfos;
}
public Share setTime() {
this.time = System.currentTimeMillis() + 60 * 60 * 1000;
return this;
}
public Share setShareId(String shareId) {
this.shareId = shareId;
return this;
}
public boolean alive(String shareId) {
return getShareId().equals(shareId) && System.currentTimeMillis() <= time;
}
}

View File

@ -37,15 +37,13 @@ public class Ali extends Spider {
@Override
public String playerContent(String flag, String id, List<String> vipFlags) {
AliYun.get().setShareId(id.split("@")[0]);
return AliYun.get().playerContent(id.split("@")[1].split("\\+"), flag.split("#")[0].equals("原畫"));
return AliYun.get().playerContent(id.split("\\+"), flag.split("#")[0].equals("原畫"));
}
private Vod parseVod(Matcher matcher, String id) {
String shareId = matcher.group(1);
String fileId = matcher.groupCount() == 3 ? matcher.group(3) : "";
AliYun.get().setShareId(shareId);
return AliYun.get().getVod(id, fileId);
return AliYun.get().getVod(id, shareId, fileId);
}
/**
@ -56,7 +54,7 @@ public class Ali extends Spider {
*/
public String detailContentVodPlayFrom(List<String> ids) {
List<String> playFrom = new ArrayList<>();
if (ids.size() < 1) return TextUtils.join("$$$", Arrays.asList("原畫", "普畫"));
if (ids.size() < 2) return TextUtils.join("$$$", Arrays.asList("原畫", "普畫"));
for (int i = 1; i <= ids.size(); i++) {
playFrom.add(String.format(Locale.getDefault(), "原畫#%02d", i));
playFrom.add(String.format(Locale.getDefault(), "普畫#%02d", i));

View File

@ -28,12 +28,12 @@ public class Miss extends Spider {
List<Vod> list = new ArrayList<>();
List<Class> classes = new ArrayList<>();
LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>();
List<String> typeIds = Arrays.asList("chinese-subtitle", "new", "release", "uncensored-leak", "today-hot", "weekly-hot", "monthly-hot", "siro", "luxu", "gana", "maan", "scute", "ara", "uncensored-leak", "fc2", "heyzo", "tokyohot", "1pondo", "caribbeancom", "caribbeancompr", "10musume", "pacopacomama", "gachinco", "xxxav", "marriedslash", "naughty4610", "naughty0930", "madou", "twav");
Document doc = Jsoup.parse(OkHttp.string(url));
for (Element a : doc.select("nav").select("a")) {
for (Element a : doc.select("nav a")) {
String typeName = a.text();
if (!a.attr("href").startsWith("http")) continue;
String typeId = a.attr("href").replace(url, "");
if (!typeIds.contains(typeId)) continue;
if (typeId.startsWith("http")) continue;
classes.add(new Class(typeId, typeName));
filters.put(typeId, Arrays.asList(new Filter("filters", "過濾", Arrays.asList(new Filter.Value("全部", ""), new Filter.Value("單人作品", "individual"), new Filter.Value("中文字幕", "chinese-subtitle")))));
}

View File

@ -7,6 +7,7 @@ import com.github.catvod.bean.Result;
import com.github.catvod.bean.Vod;
import com.github.catvod.net.OkHttp;
import com.github.catvod.utils.Utils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.jsoup.Jsoup;
@ -31,7 +32,7 @@ public class Wogg extends Ali {
private final Pattern regexCategory = Pattern.compile("/vodtype/(\\w+).html");
private final Pattern regexPageTotal = Pattern.compile("\\$\\(\"\\.mac_total\"\\)\\.text\\('(\\d+)'\\);");
private String extend;
private JsonObject extend;
private Map<String, String> getHeader() {
Map<String, String> header = new HashMap<>();
@ -41,12 +42,14 @@ public class Wogg extends Ali {
@Override
public void init(Context context, String extend) {
this.extend = extend;
this.extend = JsonParser.parseString(extend).getAsJsonObject();
super.init(context, this.extend.get("token").getAsString());
}
@Override
public String homeContent(boolean filter) {
List<Class> classes = new ArrayList<>();
String url = extend.get("filter").getAsString();
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeader()));
Elements elements = doc.select(".nav-link");
for (Element e : elements) {
@ -55,7 +58,7 @@ public class Wogg extends Ali {
classes.add(new Class(mather.group(1), e.text().trim()));
}
}
return Result.string(classes, this.parseVodListFromDoc(doc), filter ? JsonParser.parseString(OkHttp.string(extend)) : null);
return Result.string(classes, parseVodListFromDoc(doc), filter ? JsonParser.parseString(OkHttp.string(url)) : null);
}
@Override
@ -71,7 +74,7 @@ public class Wogg extends Ali {
Matcher matcher = regexPageTotal.matcher(doc.html());
if (matcher.find()) total = Integer.parseInt(matcher.group(1));
int count = total <= limit ? 1 : ((int) Math.ceil(total / (double) limit));
return Result.get().vod(this.parseVodListFromDoc(doc)).page(page, count, limit, total).string();
return Result.get().vod(parseVodListFromDoc(doc)).page(page, count, limit, total).string();
}
private List<Vod> parseVodListFromDoc(Document doc) {

View File

@ -1,124 +0,0 @@
package com.github.catvod.utils;
import java.text.Collator;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* 按照 Windows 排序风格对给定的数字字母汉字字符串进行排序
*
* @author Oiltea
*/
public class ChineseComparator {
/**
* 数字类型
*/
private static final Integer TYPE_NUMBER = 0;
/**
* 字符类型非数字
*/
private static final Integer TYPE_CHARACTER = 1;
public static int compare(String o1, String o2) {
// 根据字符数组生成带分类的字符列表
// List<Object>的第一位为该字符的类型(TYPE_NUMBER, TYPE_CHARACTER)
// List<Object>的第二位为该字符的内容(一位数字, 一位非数字, 多位数字)
List<List<Object>> o1CharList = getCharList(o1);
List<List<Object>> o2CharList = getCharList(o2);
// 统一CharList的长度
int max = Math.max(o1CharList.size(), o2CharList.size());
while (o1CharList.size() < max) {
o1CharList.add(new ArrayList<>());
}
while (o2CharList.size() < max) {
o2CharList.add(new ArrayList<>());
}
// 开始比较
int compare = 0;
for (int i = 0; i < max; i++) {
List<Object> o1list = o1CharList.get(i);
List<Object> o2list = o2CharList.get(i);
// CharList短的排在前面
if (o1list.size() == 0) {
compare = -1;
break;
}
if (o2list.size() == 0) {
compare = 1;
break;
}
// 先比较类型
Integer o1Type = (Integer) o1list.get(0);
Integer o2Type = (Integer) o2list.get(0);
int typeCompare = Integer.compare(o1Type, o2Type);
if (typeCompare != 0) {
// 类型不同则数字在前非数字在后
compare = typeCompare;
break;
} else {
// 类型相同则比较内容
if (TYPE_NUMBER.equals(o1Type)) {
// 比较数字
int o1Content = Integer.parseInt(o1list.get(1).toString());
int o2Content = Integer.parseInt(o2list.get(1).toString());
compare = Integer.compare(o1Content, o2Content);
} else if (TYPE_CHARACTER.equals(o1Type)) {
// 比较非数字
String o1Content = (String) o1list.get(1);
String o2Content = (String) o2list.get(1);
compare = Collator.getInstance(Locale.CHINESE).compare(o1Content, o2Content);
}
// 如果不相等则退出比较
if (compare != 0) {
break;
}
}
}
return compare;
}
/**
* 根据字符数组生成带分类的字符列表
*
* @param text 字符串
* @return 带分类的字符列表List<Object>的第一位为该字符的类型(TYPE_NUMBER, TYPE_CHARACTER)第二位为该字符的内容
*/
private static List<List<Object>> getCharList(String text) {
char[] chars = text.toCharArray();
List<List<Object>> charList = new ArrayList<>();
for (int i = 0; i < chars.length; i++) {
List<Object> list = new ArrayList<>();
// 是否为数字
char c = chars[i];
if ((int) c >= '0' && (int) c <= '9') {
StringBuilder str = new StringBuilder();
// 下一位是否为数字如果为数字则组成多位数
do {
str.append(c);
if (i + 1 < chars.length) {
c = chars[++i];
} else {
break;
}
} while ((int) c >= '0' && (int) c <= '9');
if (!(i + 1 == chars.length) || !((int) c >= '0' && (int) c <= '9')) {
i--;
}
list.add(TYPE_NUMBER);
list.add(str.toString());
} else {
list.add(TYPE_CHARACTER);
list.add(String.valueOf(c));
}
charList.add(list);
}
return charList;
}
}

View File

@ -21,6 +21,7 @@ import java.security.MessageDigest;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
@ -28,11 +29,7 @@ public class Utils {
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36";
public static final String ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
public static final List<String> MEDIA = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "mp3", "aac", "flac", "m4a", "ape", "ogg");
public static final Pattern RULE = Pattern.compile(
"http((?!http).){12,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)\\?.*|" +
"http((?!http).){12,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)|" +
"http((?!http).)*?video/tos*"
);
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)\\?.*|" + "http((?!http).){12,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)|" + "http((?!http).)*?video/tos*");
public static boolean isVip(String url) {
List<String> hosts = Arrays.asList("iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com");
@ -194,4 +191,14 @@ public class Utils {
webView.loadUrl(url);
});
}
public static int getDigit(String text) {
try {
Matcher matcher = Pattern.compile(".*(1080|720|2160|4k|4K).*").matcher(text);
if (matcher.find()) text = matcher.group(1) + text;
return Integer.parseInt(text.replaceAll("\\D+", ""));
} catch (Exception e) {
return -1;
}
}
}

Binary file not shown.

View File

@ -1 +1 @@
dede7a67d11523b79d649c152910fd6a
a296bd2bc81da9960738fa6edd394246