Merge branch 'main' of https://github.com/FongMi/CatVodSpider
This commit is contained in:
commit
edf4268b82
|
|
@ -3,6 +3,8 @@
|
|||
package="com.github.catvod">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import com.github.catvod.net.OkHttp;
|
|||
import com.github.catvod.net.OkResult;
|
||||
import com.github.catvod.spider.Init;
|
||||
import com.github.catvod.spider.Proxy;
|
||||
import com.github.catvod.utils.Prefers;
|
||||
import com.github.catvod.utils.FileUtil;
|
||||
import com.github.catvod.utils.QRCode;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
|
|
@ -34,6 +34,7 @@ import org.json.JSONArray;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -66,10 +67,18 @@ public class API {
|
|||
return Loader.INSTANCE;
|
||||
}
|
||||
|
||||
public File getUserCache() {
|
||||
return FileUtil.getCacheFile("aliyundrive_user");
|
||||
}
|
||||
|
||||
public File getOAuthCache() {
|
||||
return FileUtil.getCacheFile("aliyundrive_oauth");
|
||||
}
|
||||
|
||||
private API() {
|
||||
tempIds = new ArrayList<>();
|
||||
oauth = OAuth.objectFrom(Prefers.getString("aliyundrive_oauth"));
|
||||
user = User.objectFrom(Prefers.getString("aliyundrive_user"));
|
||||
oauth = OAuth.objectFrom(FileUtil.read(getOAuthCache()));
|
||||
user = User.objectFrom(FileUtil.read(getUserCache()));
|
||||
quality = new HashMap<>();
|
||||
quality.put("4K", "UHD");
|
||||
quality.put("2k", "QHD");
|
||||
|
|
@ -432,9 +441,7 @@ public class API {
|
|||
if (Utils.isMobile()) {
|
||||
Init.run(this::showInput);
|
||||
} else {
|
||||
String url = "https://passport.aliyundrive.com/newlogin/qrcode/generate.do?appName=aliyun_drive&fromSite=52&appName=aliyun_drive&appEntrance=web&isMobile=false&lang=zh_CN&returnUrl=&bizParams=&_bx-v=2.2.3";
|
||||
Data data = Data.objectFrom(OkHttp.string(url)).getContent().getData();
|
||||
Init.run(() -> showQRCode(data));
|
||||
showQRCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -445,13 +452,18 @@ public class API {
|
|||
FrameLayout frame = new FrameLayout(Init.context());
|
||||
EditText input = new EditText(Init.context());
|
||||
frame.addView(input, params);
|
||||
dialog = new AlertDialog.Builder(Init.getActivity()).setTitle("請輸入Token").setView(frame).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, (dialog, which) -> onPositive(input.getText().toString())).show();
|
||||
dialog = new AlertDialog.Builder(Init.getActivity()).setTitle("請輸入Token").setView(frame).setNeutralButton("QRCode", (dialog, which) -> onNeutral()).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, (dialog, which) -> onPositive(input.getText().toString())).show();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
private void onNeutral() {
|
||||
dismiss();
|
||||
Init.execute(this::showQRCode);
|
||||
}
|
||||
|
||||
private void onPositive(String text) {
|
||||
dialog.dismiss();
|
||||
dismiss();
|
||||
Init.execute(() -> {
|
||||
if (text.startsWith("http")) setToken(OkHttp.string(text));
|
||||
else if (text.length() == 32) setToken(text);
|
||||
|
|
@ -459,6 +471,12 @@ public class API {
|
|||
});
|
||||
}
|
||||
|
||||
private void showQRCode() {
|
||||
String url = "https://passport.aliyundrive.com/newlogin/qrcode/generate.do?appName=aliyun_drive&fromSite=52&appName=aliyun_drive&appEntrance=web&isMobile=false&lang=zh_CN&returnUrl=&bizParams=&_bx-v=2.2.3";
|
||||
Data data = Data.objectFrom(OkHttp.string(url)).getContent().getData();
|
||||
Init.run(() -> showQRCode(data));
|
||||
}
|
||||
|
||||
private void showQRCode(Data data) {
|
||||
try {
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(Utils.dp2px(240), Utils.dp2px(240));
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.github.catvod.bean.ali;
|
|||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.utils.Prefers;
|
||||
import com.github.catvod.ali.API;
|
||||
import com.github.catvod.utils.FileUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ public class OAuth {
|
|||
}
|
||||
|
||||
public OAuth save() {
|
||||
Prefers.put("aliyundrive_oauth", toString());
|
||||
FileUtil.write(API.get().getOAuthCache(), toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.github.catvod.bean.ali;
|
|||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.utils.Prefers;
|
||||
import com.github.catvod.ali.API;
|
||||
import com.github.catvod.utils.FileUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ public class User {
|
|||
}
|
||||
|
||||
public User save() {
|
||||
Prefers.put("aliyundrive_user", toString());
|
||||
FileUtil.write(API.get().getUserCache(), toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import android.text.TextUtils;
|
|||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Image;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ public class Drive {
|
|||
}
|
||||
|
||||
public String getVodPic() {
|
||||
return TextUtils.isEmpty(vodPic) ? "https://s1.ax1x.com/2023/04/03/pp4F4bT.png" : vodPic;
|
||||
return TextUtils.isEmpty(vodPic) ? Image.FOLDER : vodPic;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class Item {
|
|||
}
|
||||
|
||||
public String getExt() {
|
||||
return getName().substring(getName().lastIndexOf(".") + 1);
|
||||
return Utils.getExt(getName());
|
||||
}
|
||||
|
||||
public String getVodId(String id) {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import java.util.List;
|
|||
|
||||
public class Drive {
|
||||
|
||||
@SerializedName("vodPic")
|
||||
private String vodPic;
|
||||
@SerializedName("drives")
|
||||
private List<Drive> drives;
|
||||
@SerializedName("name")
|
||||
|
|
@ -46,10 +44,6 @@ public class Drive {
|
|||
return drives == null ? new ArrayList<>() : drives;
|
||||
}
|
||||
|
||||
public String getVodPic() {
|
||||
return TextUtils.isEmpty(vodPic) ? "" : vodPic;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.json.JSONArray;
|
|||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -201,12 +202,14 @@ public class Bili extends Spider {
|
|||
}
|
||||
|
||||
private void setCookie(String url) {
|
||||
Map<String, List<String>> respHeader = new HashMap<>();
|
||||
OkHttp.stringNoRedirect(url, header, respHeader);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String value : Objects.requireNonNull(respHeader.get("set-cookie"))) sb.append(value.split(";")[0]).append(";");
|
||||
Init.run(() -> Prefers.put("BiliQRCode", true), 5000);
|
||||
Prefers.put("BiliCookie", sb.toString());
|
||||
String cookie = "";
|
||||
try {
|
||||
URL abc = new URL(url);
|
||||
String[] kk = abc.getQuery().split("&");
|
||||
for (String a : kk) cookie += a + ";";
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
Prefers.put("BiliCookie", cookie);
|
||||
Init.show("請重新進入播放頁");
|
||||
stopService();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Sub;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.utils.Image;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Local extends Spider {
|
||||
|
||||
private SimpleDateFormat format;
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
format = new SimpleDateFormat("yyyyy/MM/dd HH:mm:ss", Locale.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
classes.add(new Class(Environment.getExternalStorageDirectory().getAbsolutePath(), "本地文件", "1"));
|
||||
File[] files = new File("/storage").listFiles();
|
||||
if (files == null) return Result.string(classes, new ArrayList<>());
|
||||
List<String> exclude = Arrays.asList("emulated", "sdcard", "self");
|
||||
for (File file : files) {
|
||||
if (exclude.contains(file.getName())) continue;
|
||||
classes.add(new Class(file.getAbsolutePath(), file.getName(), "1"));
|
||||
}
|
||||
return Result.string(classes, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
List<Vod> items = new ArrayList<>();
|
||||
List<Vod> media = new ArrayList<>();
|
||||
List<Vod> folders = new ArrayList<>();
|
||||
File[] files = new File(tid).listFiles();
|
||||
if (files == null) return Result.string(items);
|
||||
Arrays.sort(files, (a, b) -> a.getName().compareTo(b.getName()));
|
||||
for (File file : files) {
|
||||
if (file.getName().startsWith(".")) continue;
|
||||
if (file.isDirectory()) folders.add(create(file));
|
||||
else if (Utils.MEDIA.contains(Utils.getExt(file.getName()))) media.add(create(file));
|
||||
}
|
||||
items.addAll(folders);
|
||||
items.addAll(media);
|
||||
return Result.string(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) {
|
||||
File file = new File(ids.get(0));
|
||||
Vod vod = new Vod();
|
||||
vod.setTypeName("FongMi");
|
||||
vod.setVodId(file.getAbsolutePath());
|
||||
vod.setVodName(file.getName());
|
||||
vod.setVodPic(Image.VIDEO);
|
||||
vod.setVodPlayFrom("播放");
|
||||
vod.setVodPlayUrl(file.getName() + "$" + file.getAbsolutePath());
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).subs(getSubs(id)).string();
|
||||
}
|
||||
|
||||
private Vod create(File file) {
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(file.getAbsolutePath());
|
||||
vod.setVodName(file.getName());
|
||||
vod.setVodPic(Image.getIcon(file.isDirectory()));
|
||||
vod.setVodRemarks(format.format(file.lastModified()));
|
||||
vod.setVodTag(file.isDirectory() ? "folder" : "file");
|
||||
return vod;
|
||||
}
|
||||
|
||||
private List<Sub> getSubs(String path) {
|
||||
File file = new File(path);
|
||||
if (file.getParentFile() == null) return Collections.emptyList();
|
||||
List<Sub> subs = new ArrayList<>();
|
||||
for (File f : Objects.requireNonNull(file.getParentFile().listFiles())) {
|
||||
String ext = Utils.getExt(f.getName());
|
||||
if (Utils.isSub(ext)) subs.add(Sub.create().name(Utils.removeExt(f.getName())).ext(ext).url("file://" + f.getAbsolutePath()));
|
||||
}
|
||||
return subs;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,11 +4,16 @@ import android.content.Context;
|
|||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Sub;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Push extends Ali {
|
||||
|
||||
|
|
@ -26,7 +31,7 @@ public class Push extends Ali {
|
|||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||
if (flag.equals("直連")) return Result.get().url(id).string();
|
||||
if (flag.equals("直連")) return Result.get().url(id).subs(getSubs(id)).string();
|
||||
if (flag.equals("嗅探")) return Result.get().parse().url(id).string();
|
||||
if (flag.equals("解析")) return Result.get().parse().jx().url(id).string();
|
||||
return super.playerContent(flag, id, vipFlags);
|
||||
|
|
@ -42,4 +47,16 @@ public class Push extends Ali {
|
|||
vod.setVodPlayUrl(TextUtils.join("$$$", Arrays.asList("播放$" + url, "播放$" + url, "播放$" + url)));
|
||||
return vod;
|
||||
}
|
||||
|
||||
private List<Sub> getSubs(String url) {
|
||||
if (!url.startsWith("file://")) return Collections.emptyList();
|
||||
File file = new File(url.replace("file://", ""));
|
||||
if (file.getParentFile() == null) return Collections.emptyList();
|
||||
List<Sub> subs = new ArrayList<>();
|
||||
for (File f : Objects.requireNonNull(file.getParentFile().listFiles())) {
|
||||
String ext = Utils.getExt(f.getName());
|
||||
if (Utils.isSub(ext)) subs.add(Sub.create().name(Utils.removeExt(f.getName())).ext(ext).url("file://" + f.getAbsolutePath()));
|
||||
}
|
||||
return subs;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ import com.github.catvod.bean.webdav.Drive;
|
|||
import com.github.catvod.bean.webdav.Sorter;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Image;
|
||||
import com.github.catvod.utils.Utils;
|
||||
import com.thegrizzlylabs.sardineandroid.DavResource;
|
||||
|
||||
|
|
@ -27,10 +28,8 @@ import java.util.Map;
|
|||
public class WebDAV extends Spider {
|
||||
|
||||
private static List<Drive> drives;
|
||||
private List<String> playExt;
|
||||
private List<String> allExt;
|
||||
private String vodPic;
|
||||
private String ext;
|
||||
private String extend;
|
||||
|
||||
private List<Filter> getFilter() {
|
||||
List<Filter> items = new ArrayList<>();
|
||||
|
|
@ -41,14 +40,13 @@ public class WebDAV extends Spider {
|
|||
|
||||
private void fetchRule() {
|
||||
if (drives != null && !drives.isEmpty()) return;
|
||||
if (ext.startsWith("http")) ext = OkHttp.string(ext);
|
||||
Drive drive = Drive.objectFrom(ext);
|
||||
if (extend.startsWith("http")) extend = OkHttp.string(extend);
|
||||
Drive drive = Drive.objectFrom(extend);
|
||||
drives = drive.getDrives();
|
||||
vodPic = drive.getVodPic();
|
||||
}
|
||||
|
||||
private String getExt(DavResource item) {
|
||||
return item.getName().substring(item.getName().lastIndexOf(".") + 1);
|
||||
return Utils.getExt(item.getName());
|
||||
}
|
||||
|
||||
private String removeExt(DavResource item) {
|
||||
|
|
@ -61,10 +59,9 @@ public class WebDAV extends Spider {
|
|||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
playExt = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "mp3", "aac", "flac", "m4a");
|
||||
allExt = new ArrayList<>(Arrays.asList("ass", "ssa", "srt"));
|
||||
allExt.addAll(playExt);
|
||||
ext = extend;
|
||||
this.allExt = new ArrayList<>(Arrays.asList("ass", "ssa", "srt"));
|
||||
this.allExt.addAll(Utils.MEDIA);
|
||||
this.extend = extend;
|
||||
fetchRule();
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +85,7 @@ public class WebDAV extends Spider {
|
|||
List<DavResource> files = new ArrayList<>();
|
||||
List<Vod> list = new ArrayList<>();
|
||||
Drive drive = getDrive(key);
|
||||
for (DavResource item : getList(drive, path, playExt)) {
|
||||
for (DavResource item : getList(drive, path, Utils.MEDIA)) {
|
||||
if (item.isDirectory()) folders.add(item);
|
||||
else files.add(item);
|
||||
}
|
||||
|
|
@ -96,8 +93,8 @@ public class WebDAV extends Spider {
|
|||
Sorter.sort(type, order, folders);
|
||||
Sorter.sort(type, order, files);
|
||||
}
|
||||
for (DavResource item : folders) list.add(drive.vod(item, vodPic));
|
||||
for (DavResource item : files) list.add(drive.vod(item, vodPic));
|
||||
for (DavResource item : folders) list.add(drive.vod(item, Image.FOLDER));
|
||||
for (DavResource item : files) list.add(drive.vod(item, Image.VIDEO));
|
||||
return Result.get().vod(list).page().string();
|
||||
}
|
||||
|
||||
|
|
@ -114,15 +111,15 @@ public class WebDAV extends Spider {
|
|||
Sorter.sort("name", "asc", parents);
|
||||
List<String> playUrls = new ArrayList<>();
|
||||
for (DavResource item : parents) {
|
||||
if (playExt.contains(getExt(item))) {
|
||||
if (Utils.MEDIA.contains(getExt(item))) {
|
||||
playUrls.add(item.getName() + "$" + drive.getName() + item.getPath() + findSubs(drive, item, subs));
|
||||
}
|
||||
}
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(name);
|
||||
vod.setVodName(name);
|
||||
vod.setVodPic(vodPic);
|
||||
vod.setVodPlayFrom(key);
|
||||
vod.setVodPic(Image.VIDEO);
|
||||
vod.setVodPlayUrl(TextUtils.join("#", playUrls));
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.github.catvod.utils;
|
||||
|
||||
import com.github.catvod.spider.Init;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class FileUtil {
|
||||
|
||||
public static File getCacheDir() {
|
||||
return Init.context().getExternalCacheDir();
|
||||
}
|
||||
|
||||
public static File getCacheFile(String fileName) {
|
||||
return new File(getCacheDir(), fileName);
|
||||
}
|
||||
|
||||
public static void write(File file, String data) {
|
||||
write(file, data.getBytes());
|
||||
}
|
||||
|
||||
public static void write(File file, byte[] data) {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.write(data);
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String read(File file) {
|
||||
try {
|
||||
return read(new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String read(InputStream is) {
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String text;
|
||||
while ((text = br.readLine()) != null) sb.append(text).append("\n");
|
||||
br.close();
|
||||
return Utils.substring(sb.toString());
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.github.catvod.utils;
|
||||
|
||||
public class Image {
|
||||
|
||||
public static final String FOLDER = "https://s1.ax1x.com/2023/05/04/p9tgI81.png";
|
||||
public static final String VIDEO = "https://s1.ax1x.com/2023/05/04/p9tgogx.png";
|
||||
|
||||
public static String getIcon(boolean folder) {
|
||||
return folder ? FOLDER : VIDEO;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.github.catvod.utils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Sniffer {
|
||||
|
||||
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*"
|
||||
);
|
||||
}
|
||||
|
|
@ -18,10 +18,17 @@ import java.security.MessageDigest;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36";
|
||||
public static final List<String> MEDIA = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "mp3", "aac", "flac", "m4a");
|
||||
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");
|
||||
|
|
@ -31,7 +38,7 @@ public class Utils {
|
|||
|
||||
public static boolean isVideoFormat(String url) {
|
||||
if (url.contains("url=http") || url.contains(".js") || url.contains(".css") || url.contains(".html")) return false;
|
||||
return Sniffer.RULE.matcher(url).find();
|
||||
return RULE.matcher(url).find();
|
||||
}
|
||||
|
||||
public static boolean isMobile() {
|
||||
|
|
@ -45,6 +52,10 @@ public class Utils {
|
|||
return ext.equals("srt") || ext.equals("ass") || ext.equals("ssa");
|
||||
}
|
||||
|
||||
public static String getExt(String name) {
|
||||
return name.substring(name.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
public static String getSize(double size) {
|
||||
if (size <= 0) return "";
|
||||
if (size > 1024 * 1024 * 1024 * 1024.0) {
|
||||
|
|
@ -144,15 +155,6 @@ public class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void removeView(View view) {
|
||||
try {
|
||||
ViewGroup group = Init.getActivity().getWindow().getDecorView().findViewById(android.R.id.content);
|
||||
group.removeView(view);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadWebView(String url, WebViewClient client) {
|
||||
Init.run(() -> {
|
||||
WebView webView = new WebView(Init.context());
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
3943d051cc917b936cbfa116baf94a74
|
||||
e276d142b10b9f2c2971664d0b9dc9a3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;3943d051cc917b936cbfa116baf94a74",
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;e276d142b10b9f2c2971664d0b9dc9a3",
|
||||
"wallpaper": "https://gao.chuqiuyu.tk",
|
||||
"sites": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"vodPic": "https://s1.ax1x.com/2023/04/04/pp5M5Jx.png",
|
||||
"vodPic": "https://s1.ax1x.com/2023/05/04/p9tgI81.png",
|
||||
"drives": [
|
||||
{
|
||||
"name": "小雅",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,16 @@
|
|||
{
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;3943d051cc917b936cbfa116baf94a74",
|
||||
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;e276d142b10b9f2c2971664d0b9dc9a3",
|
||||
"wallpaper": "http://饭太硬.ga/深色壁纸/api.php",
|
||||
"sites": [
|
||||
{
|
||||
"key": "本地",
|
||||
"name": "本地",
|
||||
"type": 3,
|
||||
"api": "csp_Local",
|
||||
"searchable": 0,
|
||||
"filterable": 0,
|
||||
"changeable": 0
|
||||
},
|
||||
{
|
||||
"key": "AList",
|
||||
"name": "AList",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"vodPic": "https://avatars.githubusercontent.com/u/3471963?v=4",
|
||||
"drives": [
|
||||
{
|
||||
"name": "七米藍",
|
||||
|
|
|
|||
Loading…
Reference in New Issue