Update
This commit is contained in:
parent
cf48a99632
commit
b0123cf681
|
|
@ -10,7 +10,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
applicationId "com.github.catvod.demo"
|
||||
minSdk 16
|
||||
minSdk 21
|
||||
targetSdk 35
|
||||
}
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ android {
|
|||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
|
|
@ -41,7 +41,7 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation 'com.github.thegrizzlylabs:sardine-android:0.9'
|
||||
implementation 'wang.harlon.quickjs:wrapper-android:0.21.1'
|
||||
implementation 'wang.harlon.quickjs:wrapper-android:2.4.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
implementation 'cn.wanghaomiao:JsoupXpath:2.5.1'
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
# Merge
|
||||
-flattenpackagehierarchy com.github.catvod.spider.merge
|
||||
-dontwarn org.slf4j.impl.StaticLoggerBinder
|
||||
|
||||
# slf4j
|
||||
-dontwarn org.slf4j.impl.**
|
||||
-keep class org.slf4j.** { *; }
|
||||
|
||||
# Spider
|
||||
-keep class com.github.catvod.js.* { *; }
|
||||
-keep class com.github.catvod.crawler.* { *; }
|
||||
-keep class com.github.catvod.spider.* { public <methods>; }
|
||||
-keep class com.github.catvod.parser.* { public <methods>; }
|
||||
|
||||
# AndroidX
|
||||
-keep class androidx.core.** { *; }
|
||||
|
|
|
|||
|
|
@ -1,653 +0,0 @@
|
|||
package com.github.catvod.api;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.UrlQuerySanitizer;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Sub;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.bean.ali.Cache;
|
||||
import com.github.catvod.bean.ali.Code;
|
||||
import com.github.catvod.bean.ali.Data;
|
||||
import com.github.catvod.bean.ali.Download;
|
||||
import com.github.catvod.bean.ali.Drive;
|
||||
import com.github.catvod.bean.ali.Item;
|
||||
import com.github.catvod.bean.ali.OAuth;
|
||||
import com.github.catvod.bean.ali.Preview;
|
||||
import com.github.catvod.bean.ali.Resp;
|
||||
import com.github.catvod.bean.ali.Share;
|
||||
import com.github.catvod.bean.ali.User;
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
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.Json;
|
||||
import com.github.catvod.utils.Notify;
|
||||
import com.github.catvod.utils.Path;
|
||||
import com.github.catvod.utils.ProxyVideo;
|
||||
import com.github.catvod.utils.QRCode;
|
||||
import com.github.catvod.utils.ResUtil;
|
||||
import com.github.catvod.utils.Util;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import okhttp3.Response;
|
||||
|
||||
public class AliYun {
|
||||
|
||||
private final Map<String, Map<String, String>> m3u8MediaMap;
|
||||
private final Map<String, String> shareDownloadMap;
|
||||
private final Map<String, String> downloadMap;
|
||||
private final List<String> tempIds;
|
||||
private final ReentrantLock lock;
|
||||
private final Cache cache;
|
||||
private ScheduledExecutorService service;
|
||||
private String refreshToken;
|
||||
private AlertDialog dialog;
|
||||
private Share share;
|
||||
|
||||
private static class Loader {
|
||||
static volatile AliYun INSTANCE = new AliYun();
|
||||
}
|
||||
|
||||
public static AliYun get() {
|
||||
return Loader.INSTANCE;
|
||||
}
|
||||
|
||||
public File getCache() {
|
||||
return Path.tv("aliyun");
|
||||
}
|
||||
|
||||
private AliYun() {
|
||||
Init.checkPermission();
|
||||
lock = new ReentrantLock();
|
||||
tempIds = new ArrayList<>();
|
||||
downloadMap = new HashMap<>();
|
||||
m3u8MediaMap = new HashMap<>();
|
||||
shareDownloadMap = new HashMap<>();
|
||||
cache = Cache.objectFrom(Path.read(getCache()));
|
||||
}
|
||||
|
||||
public void setRefreshToken(String token) {
|
||||
this.refreshToken = token;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getHeader() {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
headers.put("Referer", "https://www.aliyundrive.com/");
|
||||
return headers;
|
||||
}
|
||||
|
||||
private HashMap<String, String> getHeaders() {
|
||||
HashMap<String, String> headers = getHeader();
|
||||
headers.put("x-share-token", share.getShareToken());
|
||||
headers.put("X-Canary", "client=Android,app=adrive,version=v4.3.1");
|
||||
return headers;
|
||||
}
|
||||
|
||||
private HashMap<String, String> getHeaderAuth() {
|
||||
HashMap<String, String> headers = getHeader();
|
||||
headers.put("x-share-token", share.getShareToken());
|
||||
headers.put("X-Canary", "client=Android,app=adrive,version=v4.3.1");
|
||||
if (cache.getUser().isAuthed()) headers.put("authorization", cache.getUser().getAuthorization());
|
||||
return headers;
|
||||
}
|
||||
|
||||
private HashMap<String, String> getHeaderOpen() {
|
||||
HashMap<String, String> headers = getHeader();
|
||||
headers.put("authorization", cache.getOAuth().getAuthorization());
|
||||
return headers;
|
||||
}
|
||||
|
||||
private boolean alist(String url, JsonObject param) {
|
||||
String api = "https://api.xhofe.top/alist/ali_open/" + url;
|
||||
OkResult result = OkHttp.post(api, param.toString(), getHeader());
|
||||
SpiderDebug.log(result.getCode() + "," + api + "," + result.getBody());
|
||||
if (isManyRequest(result.getBody())) return false;
|
||||
cache.setOAuth(OAuth.objectFrom(result.getBody()));
|
||||
return true;
|
||||
}
|
||||
|
||||
private String post(String url, JsonObject param) {
|
||||
url = url.startsWith("https") ? url : "https://api.aliyundrive.com/" + url;
|
||||
OkResult result = OkHttp.post(url, param.toString(), getHeader());
|
||||
SpiderDebug.log(result.getCode() + "," + url + "," + result.getBody());
|
||||
return result.getBody();
|
||||
}
|
||||
|
||||
private String auth(String url, String json, boolean retry) {
|
||||
url = url.startsWith("https") ? url : "https://api.aliyundrive.com/" + url;
|
||||
OkResult result = OkHttp.post(url, json, url.contains("file/list") ? getHeaders() : getHeaderAuth());
|
||||
SpiderDebug.log(result.getCode() + "," + url + "," + result.getBody());
|
||||
if (retry && result.getCode() == 401 && refreshAccessToken()) return auth(url, json, false);
|
||||
if (retry && result.getCode() == 429) return auth(url, json, false);
|
||||
return result.getBody();
|
||||
}
|
||||
|
||||
private String oauth(String url, String json, boolean retry) {
|
||||
url = url.startsWith("https") ? url : "https://open.aliyundrive.com/adrive/v1.0/" + url;
|
||||
OkResult result = OkHttp.post(url, json, getHeaderOpen());
|
||||
SpiderDebug.log(result.getCode() + "," + url + "," + result.getBody());
|
||||
if (retry && (result.getCode() == 400 || result.getCode() == 401) && refreshOpenToken()) return oauth(url, json, false);
|
||||
return result.getBody();
|
||||
}
|
||||
|
||||
private boolean isManyRequest(String result) {
|
||||
if (!result.contains("Too Many Requests")) return false;
|
||||
Notify.show("洗洗睡吧,Too Many Requests。");
|
||||
cache.getOAuth().clean();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onTimeout() {
|
||||
stopService();
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
share = Share.objectFrom(json).setShareId(shareId).setTime();
|
||||
if (share.getShareToken().isEmpty()) Notify.show("來晚啦,該分享已失效。");
|
||||
}
|
||||
|
||||
private boolean refreshAccessToken() {
|
||||
try {
|
||||
SpiderDebug.log("refreshAccessToken...");
|
||||
JsonObject param = new JsonObject();
|
||||
String token = cache.getUser().getRefreshToken();
|
||||
if (token.isEmpty()) token = refreshToken;
|
||||
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);
|
||||
cache.setUser(User.objectFrom(json));
|
||||
if (cache.getUser().getAccessToken().isEmpty()) throw new Exception(json);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
if (e instanceof TimeoutException) return onTimeout();
|
||||
cache.getUser().clean();
|
||||
e.printStackTrace();
|
||||
stopService();
|
||||
startFlow();
|
||||
return true;
|
||||
} finally {
|
||||
while (cache.getUser().getAccessToken().isEmpty()) SystemClock.sleep(250);
|
||||
}
|
||||
}
|
||||
|
||||
private void getDriveId() {
|
||||
SpiderDebug.log("Get Drive Id...");
|
||||
String json = auth("https://user.aliyundrive.com/v2/user/get", "{}", true);
|
||||
cache.setDrive(Drive.objectFrom(json));
|
||||
}
|
||||
|
||||
private boolean oauthRequest() {
|
||||
SpiderDebug.log("OAuth Request...");
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("authorize", 1);
|
||||
param.addProperty("scope", "user:base,file:all:read,file:all:write");
|
||||
String url = "https://open.aliyundrive.com/oauth/users/authorize?client_id=76917ccccd4441c39457a04f6084fb2f&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=";
|
||||
String json = auth(url, param.toString(), true);
|
||||
return oauthRedirect(Code.objectFrom(json).getCode());
|
||||
}
|
||||
|
||||
private boolean oauthRedirect(String code) {
|
||||
SpiderDebug.log("OAuth Redirect...");
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("code", code);
|
||||
param.addProperty("grant_type", "authorization_code");
|
||||
return alist("code", param);
|
||||
}
|
||||
|
||||
private boolean refreshOpenToken() {
|
||||
if (cache.getOAuth().getRefreshToken().isEmpty()) return oauthRequest();
|
||||
SpiderDebug.log("refreshOpenToken...");
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("grant_type", "refresh_token");
|
||||
param.addProperty("refresh_token", cache.getOAuth().getRefreshToken());
|
||||
return alist("token", param);
|
||||
}
|
||||
|
||||
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(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 (int i = 0; i < playFrom.size(); i++) playUrl.add(TextUtils.join("#", episode));
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(url);
|
||||
vod.setVodContent(url);
|
||||
vod.setVodPic(share.getAvatar());
|
||||
vod.setVodName(share.getShareName());
|
||||
vod.setVodPlayUrl(TextUtils.join("$$$", playUrl));
|
||||
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom));
|
||||
vod.setTypeName("阿里雲盤");
|
||||
return vod;
|
||||
}
|
||||
|
||||
private void listFiles(String shareId, Item folder, List<Item> files, List<Item> subs) {
|
||||
listFiles(shareId, folder, files, subs, "");
|
||||
}
|
||||
|
||||
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);
|
||||
param.addProperty("share_id", shareId);
|
||||
param.addProperty("parent_file_id", parent.getFileId());
|
||||
param.addProperty("order_by", "name");
|
||||
param.addProperty("order_direction", "ASC");
|
||||
if (marker.length() > 0) param.addProperty("marker", marker);
|
||||
Item item = Item.objectFrom(auth("adrive/v3/file/list", param.toString(), true));
|
||||
for (Item file : item.getItems()) {
|
||||
if (file.getType().equals("folder")) {
|
||||
folders.add(file);
|
||||
} else if (file.getCategory().equals("video") || file.getCategory().equals("audio")) {
|
||||
files.add(file.parent(parent.getName()));
|
||||
} else if (Util.isSub(file.getExt())) {
|
||||
subs.add(file);
|
||||
}
|
||||
}
|
||||
if (item.getNextMarker().length() > 0) {
|
||||
listFiles(shareId, parent, files, subs, item.getNextMarker());
|
||||
}
|
||||
for (Item folder : folders) {
|
||||
listFiles(shareId, folder, files, subs);
|
||||
}
|
||||
}
|
||||
|
||||
private String getParentFileId(String fileId, Share share) {
|
||||
if (!TextUtils.isEmpty(fileId)) return fileId;
|
||||
if (share.getFileInfos().isEmpty()) return "";
|
||||
Item item = share.getFileInfos().get(0);
|
||||
return item.getType().equals("folder") ? item.getFileId() : "root";
|
||||
}
|
||||
|
||||
private void pair(String name1, List<Item> items, List<Item> subs) {
|
||||
for (Item item : items) {
|
||||
String name2 = Util.removeExt(item.getName()).toLowerCase();
|
||||
if (name1.contains(name2) || name2.contains(name1)) subs.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private String findSubs(String name1, List<Item> items) {
|
||||
List<Item> subs = new ArrayList<>();
|
||||
pair(Util.removeExt(name1).toLowerCase(), items, subs);
|
||||
if (subs.isEmpty()) subs.addAll(items);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Item sub : subs) sb.append("+").append(Util.removeExt(sub.getName())).append("@@@").append(sub.getExt()).append("@@@").append(sub.getFileId());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public List<Sub> getSubs(String[] ids) {
|
||||
List<Sub> sub = new ArrayList<>();
|
||||
for (String text : ids) {
|
||||
if (!text.contains("@@@")) continue;
|
||||
String[] split = text.split("@@@");
|
||||
String name = split[0];
|
||||
String ext = split[1];
|
||||
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 getShareDownloadUrl(String shareId, String fileId) {
|
||||
try {
|
||||
if (shareDownloadMap.containsKey(fileId) && shareDownloadMap.get(fileId) != null && !isExpire(shareDownloadMap.get(fileId))) return shareDownloadMap.get(fileId);
|
||||
refreshShareToken(shareId);
|
||||
SpiderDebug.log("getShareDownloadUrl..." + fileId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("file_id", fileId);
|
||||
param.addProperty("share_id", shareId);
|
||||
param.addProperty("expire_sec", 600);
|
||||
String json = auth("v2/file/get_share_link_download_url", param.toString(), false);
|
||||
String url = Json.parse(json).getAsJsonObject().get("download_url").getAsString();
|
||||
shareDownloadMap.put(fileId, url);
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getDownloadUrl(String shareId, String fileId) {
|
||||
try {
|
||||
if (downloadMap.containsKey(fileId) && downloadMap.get(fileId) != null && !isExpire(downloadMap.get(fileId))) return downloadMap.get(fileId);
|
||||
refreshShareToken(shareId);
|
||||
SpiderDebug.log("getDownloadUrl..." + fileId);
|
||||
tempIds.add(0, copy(shareId, fileId));
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("file_id", tempIds.get(0));
|
||||
param.addProperty("drive_id", cache.getDrive().getDriveId());
|
||||
param.addProperty("expire_sec", 900);
|
||||
String json = oauth("openFile/getDownloadUrl", param.toString(), true);
|
||||
String url = Download.objectFrom(json).getUrl();
|
||||
downloadMap.put(fileId, url);
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
} finally {
|
||||
Init.execute(this::deleteAll);
|
||||
}
|
||||
}
|
||||
|
||||
public Preview.Info getVideoPreviewPlayInfo(String shareId, String fileId) {
|
||||
try {
|
||||
refreshShareToken(shareId);
|
||||
SpiderDebug.log("getVideoPreviewPlayInfo..." + fileId);
|
||||
tempIds.add(0, copy(shareId, fileId));
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("file_id", tempIds.get(0));
|
||||
param.addProperty("drive_id", cache.getDrive().getDriveId());
|
||||
param.addProperty("category", "live_transcoding");
|
||||
param.addProperty("url_expire_sec", 900);
|
||||
String json = oauth("openFile/getVideoPreviewPlayInfo", param.toString(), true);
|
||||
return Preview.objectFrom(json).getVideoPreviewPlayInfo();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new Preview.Info();
|
||||
} finally {
|
||||
Init.execute(this::deleteAll);
|
||||
}
|
||||
}
|
||||
|
||||
public String playerContent(String[] ids, String flag) {
|
||||
if (flag.split("#")[0].equals("代理普畫")) {
|
||||
return getPreviewContent(ids);
|
||||
} else if (flag.split("#")[0].equals("轉存原畫")) {
|
||||
return Result.get().url(proxyVideoUrl("open", ids[0], ids[1])).octet().subs(getSubs(ids)).header(getHeader()).string();
|
||||
} else if (flag.split("#")[0].equals("分享原畫")) {
|
||||
return Result.get().url(proxyVideoUrl("share", ids[0], ids[1])).octet().subs(getSubs(ids)).header(getHeader()).string();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String getPreviewContent(String[] ids) {
|
||||
Preview.Info info = getVideoPreviewPlayInfo(ids[0], ids[1]);
|
||||
List<String> url = getPreviewUrl(info, ids[0], ids[1], true);
|
||||
List<Sub> subs = getSubs(ids);
|
||||
subs.addAll(getSubs(info));
|
||||
return Result.get().url(url).m3u8().subs(subs).header(getHeader()).string();
|
||||
}
|
||||
|
||||
private List<String> getPreviewUrl(Preview.Info info, String shareId, String fileId, boolean proxy) {
|
||||
List<Preview.LiveTranscodingTask> tasks = info.getLiveTranscodingTaskList();
|
||||
List<String> url = new ArrayList<>();
|
||||
for (int i = tasks.size() - 1; i >= 0; i--) {
|
||||
url.add(tasks.get(i).getTemplateId());
|
||||
url.add(proxy ? proxyVideoUrl("preview", shareId, fileId, tasks.get(i).getTemplateId()) : tasks.get(i).getUrl());
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<Sub> getSubs(Preview.Info info) {
|
||||
List<Sub> subs = new ArrayList<>();
|
||||
for (Preview.LiveTranscodingTask task : info.getLiveTranscodingSubtitleTaskList()) subs.add(task.getSub());
|
||||
return subs;
|
||||
}
|
||||
|
||||
private String copy(String shareId, String fileId) {
|
||||
if (cache.getDrive().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, cache.getDrive().getDriveId());
|
||||
Resp resp = Resp.objectFrom(auth("adrive/v2/batch", json, true));
|
||||
return resp.getResponse().getBody().getFileId();
|
||||
}
|
||||
|
||||
private void deleteAll() {
|
||||
List<String> ids = new ArrayList<>(tempIds);
|
||||
for (String id : ids) {
|
||||
boolean deleted = delete(id);
|
||||
if (deleted) tempIds.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
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, cache.getDrive().getDriveId(), fileId, fileId);
|
||||
Resp resp = Resp.objectFrom(auth("adrive/v2/batch", json, true));
|
||||
return resp.getResponse().getStatus() == 404;
|
||||
}
|
||||
|
||||
private String proxyVideoUrl(String cate, String shareId, String fileId) {
|
||||
return String.format(Proxy.getUrl() + "?do=ali&type=video&cate=%s&shareId=%s&fileId=%s", cate, shareId, fileId);
|
||||
}
|
||||
|
||||
private String proxyVideoUrl(String cate, String shareId, String fileId, String templateId) {
|
||||
return String.format(Proxy.getUrl() + "?do=ali&type=video&cate=%s&shareId=%s&fileId=%s&templateId=%s", cate, shareId, fileId, templateId);
|
||||
}
|
||||
|
||||
private String proxyVideoUrl(String cate, String shareId, String fileId, String templateId, String mediaId) {
|
||||
return String.format(Proxy.getUrl() + "?do=ali&type=video&cate=%s&shareId=%s&fileId=%s&templateId=%s&mediaId=%s", cate, shareId, fileId, templateId, mediaId);
|
||||
}
|
||||
|
||||
private static boolean isExpire(String url) {
|
||||
String expires = new UrlQuerySanitizer(url).getValue("x-oss-expires");
|
||||
if (TextUtils.isEmpty(expires)) return false;
|
||||
return Long.parseLong(expires) - getTimeStamp() <= 60;
|
||||
}
|
||||
|
||||
private static long getTimeStamp() {
|
||||
return System.currentTimeMillis() / 1000;
|
||||
}
|
||||
|
||||
public Object[] proxyVideo(Map<String, String> params) throws Exception {
|
||||
if (dialog != null && dialog.isShowing()) return null;
|
||||
String templateId = params.get("templateId");
|
||||
String shareId = params.get("shareId");
|
||||
String mediaId = params.get("mediaId");
|
||||
String fileId = params.get("fileId");
|
||||
String cate = params.get("cate");
|
||||
String downloadUrl = "";
|
||||
|
||||
if ("preview".equals(cate)) {
|
||||
return new Object[]{200, "application/vnd.apple.mpegurl", new ByteArrayInputStream(getM3u8(shareId, fileId, templateId).getBytes())};
|
||||
}
|
||||
|
||||
if ("open".equals(cate)) {
|
||||
downloadUrl = getDownloadUrl(shareId, fileId);
|
||||
} else if ("share".equals(cate)) {
|
||||
downloadUrl = getShareDownloadUrl(shareId, fileId);
|
||||
} else if ("m3u8".equals(cate)) {
|
||||
lock.lock();
|
||||
String mediaUrl = m3u8MediaMap.get(fileId).get(mediaId);
|
||||
if (isExpire(mediaUrl)) {
|
||||
getM3u8(shareId, fileId, templateId);
|
||||
mediaUrl = m3u8MediaMap.get(fileId).get(mediaId);
|
||||
}
|
||||
lock.unlock();
|
||||
downloadUrl = mediaUrl;
|
||||
}
|
||||
|
||||
Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
List<String> keys = Arrays.asList("referer", "icy-metadata", "range", "connection", "accept-encoding", "user-agent");
|
||||
for (String key : params.keySet()) if (keys.contains(key)) headers.put(key, params.get(key));
|
||||
return ProxyVideo.proxy(downloadUrl, headers);
|
||||
}
|
||||
|
||||
private String getM3u8Url(String shareId, String fileId, String templateId) {
|
||||
Preview.Info info = getVideoPreviewPlayInfo(shareId, fileId);
|
||||
List<String> url = getPreviewUrl(info, shareId, fileId, false);
|
||||
Map<String, String> previewMap = new HashMap<>();
|
||||
for (int i = 0; i < url.size(); i = i + 2) {
|
||||
previewMap.put(url.get(i), url.get(i + 1));
|
||||
}
|
||||
return previewMap.get(templateId);
|
||||
}
|
||||
|
||||
private String getM3u8(String shareId, String fileId, String templateId) {
|
||||
String m3u8Url = getM3u8Url(shareId, fileId, templateId);
|
||||
String m3u8 = OkHttp.string(m3u8Url, getHeader());
|
||||
String[] m3u8Arr = m3u8.split("\n");
|
||||
List<String> listM3u8 = new ArrayList<>();
|
||||
Map<String, String> media = new HashMap<>();
|
||||
String site = m3u8Url.substring(0, m3u8Url.lastIndexOf("/")) + "/";
|
||||
int mediaId = 0;
|
||||
for (String oneLine : m3u8Arr) {
|
||||
String thisOne = oneLine;
|
||||
if (oneLine.contains("x-oss-expires")) {
|
||||
media.put(String.valueOf(mediaId), site + thisOne);
|
||||
thisOne = proxyVideoUrl("m3u8", shareId, fileId, templateId, String.valueOf(mediaId));
|
||||
mediaId++;
|
||||
}
|
||||
listM3u8.add(thisOne);
|
||||
}
|
||||
m3u8MediaMap.put(fileId, media);
|
||||
return TextUtils.join("\n", listM3u8);
|
||||
}
|
||||
|
||||
public Object[] proxySub(Map<String, String> params) throws Exception {
|
||||
String fileId = params.get("fileId");
|
||||
String shareId = params.get("shareId");
|
||||
Response res = OkHttp.newCall(getDownloadUrl(shareId, fileId), getHeaderAuth());
|
||||
Object[] result = new Object[3];
|
||||
result[0] = 200;
|
||||
result[1] = "application/octet-stream";
|
||||
result[2] = new ByteArrayInputStream(res.body().bytes());
|
||||
return result;
|
||||
}
|
||||
|
||||
private void startFlow() {
|
||||
Init.run(this::showInput);
|
||||
}
|
||||
|
||||
private void showInput() {
|
||||
try {
|
||||
int margin = ResUtil.dp2px(16);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
FrameLayout frame = new FrameLayout(Init.context());
|
||||
params.setMargins(margin, margin, margin, margin);
|
||||
EditText input = new EditText(Init.context());
|
||||
frame.addView(input, params);
|
||||
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::getQRCode);
|
||||
}
|
||||
|
||||
private void onPositive(String text) {
|
||||
dismiss();
|
||||
Init.execute(() -> {
|
||||
if (text.startsWith("http")) setToken(OkHttp.string(text));
|
||||
else setToken(text);
|
||||
});
|
||||
}
|
||||
|
||||
private void getQRCode() {
|
||||
String json = OkHttp.string("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(json).getContent().getData();
|
||||
Init.run(() -> openApp(json, data));
|
||||
}
|
||||
|
||||
private void openApp(String json, Data data) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setClassName("com.alicloud.databox", "com.taobao.login4android.scan.QrScanActivity");
|
||||
intent.putExtra("key_scanParam", json);
|
||||
Init.getActivity().startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
showQRCode(data);
|
||||
} finally {
|
||||
Init.execute(() -> startService(data.getParams()));
|
||||
}
|
||||
}
|
||||
|
||||
private void showQRCode(Data data) {
|
||||
try {
|
||||
int size = ResUtil.dp2px(240);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(size, size);
|
||||
ImageView image = new ImageView(Init.context());
|
||||
image.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
image.setImageBitmap(QRCode.getBitmap(data.getCodeContent(), size, 2));
|
||||
FrameLayout frame = new FrameLayout(Init.context());
|
||||
params.gravity = Gravity.CENTER;
|
||||
frame.addView(image, params);
|
||||
dialog = new AlertDialog.Builder(Init.getActivity()).setView(frame).setOnCancelListener(this::dismiss).setOnDismissListener(this::dismiss).show();
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
Notify.show("請使用阿里雲盤 App 掃描二維碼");
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
private void startService(Map<String, String> params) {
|
||||
service = Executors.newScheduledThreadPool(1);
|
||||
service.scheduleAtFixedRate(() -> {
|
||||
String result = OkHttp.post("https://passport.aliyundrive.com/newlogin/qrcode/query.do?appName=aliyun_drive&fromSite=52&_bx-v=2.2.3", params);
|
||||
Data data = Data.objectFrom(result).getContent().getData();
|
||||
if (data.hasToken()) setToken(data.getToken());
|
||||
}, 1, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void setToken(String value) {
|
||||
cache.getUser().setRefreshToken(value);
|
||||
SpiderDebug.log("Token:" + value);
|
||||
Notify.show("Token:" + value);
|
||||
refreshAccessToken();
|
||||
stopService();
|
||||
}
|
||||
|
||||
private void stopService() {
|
||||
if (service != null) service.shutdownNow();
|
||||
Init.run(this::dismiss);
|
||||
}
|
||||
|
||||
private void dismiss(DialogInterface dialog) {
|
||||
stopService();
|
||||
}
|
||||
|
||||
private void dismiss() {
|
||||
try {
|
||||
if (dialog != null) dialog.dismiss();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Biz {
|
||||
|
||||
@SerializedName("pds_login_result")
|
||||
private Biz pdsLoginResult;
|
||||
@SerializedName("role")
|
||||
private String role;
|
||||
@SerializedName("isFirstLogin")
|
||||
private Boolean isFirstLogin;
|
||||
@SerializedName("needLink")
|
||||
private Boolean needLink;
|
||||
@SerializedName("loginType")
|
||||
private String loginType;
|
||||
@SerializedName("nickName")
|
||||
private String nickName;
|
||||
@SerializedName("needRpVerify")
|
||||
private Boolean needRpVerify;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("accessToken")
|
||||
private String accessToken;
|
||||
@SerializedName("userName")
|
||||
private String userName;
|
||||
@SerializedName("userId")
|
||||
private String userId;
|
||||
@SerializedName("defaultDriveId")
|
||||
private String defaultDriveId;
|
||||
@SerializedName("existLink")
|
||||
private List<?> existLink;
|
||||
@SerializedName("expiresIn")
|
||||
private Integer expiresIn;
|
||||
@SerializedName("expireTime")
|
||||
private String expireTime;
|
||||
@SerializedName("requestId")
|
||||
private String requestId;
|
||||
@SerializedName("dataPinSetup")
|
||||
private Boolean dataPinSetup;
|
||||
@SerializedName("state")
|
||||
private String state;
|
||||
@SerializedName("tokenType")
|
||||
private String tokenType;
|
||||
@SerializedName("dataPinSaved")
|
||||
private Boolean dataPinSaved;
|
||||
@SerializedName("refreshToken")
|
||||
private String refreshToken;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
|
||||
public static Biz objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Biz.class);
|
||||
}
|
||||
|
||||
public Biz getPdsLoginResult() {
|
||||
return pdsLoginResult;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import com.github.catvod.api.AliYun;
|
||||
import com.github.catvod.spider.Init;
|
||||
import com.github.catvod.utils.Path;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Cache {
|
||||
|
||||
@SerializedName("user")
|
||||
private User user;
|
||||
@SerializedName("oauth")
|
||||
private OAuth oauth;
|
||||
@SerializedName("drive")
|
||||
private Drive drive;
|
||||
|
||||
public static Cache objectFrom(String str) {
|
||||
Cache item = new Gson().fromJson(str, Cache.class);
|
||||
return item == null ? new Cache() : item;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user == null ? new User() : user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public OAuth getOAuth() {
|
||||
return oauth == null ? new OAuth() : oauth;
|
||||
}
|
||||
|
||||
public void setOAuth(OAuth oauth) {
|
||||
this.oauth = oauth;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public Drive getDrive() {
|
||||
return drive == null ? new Drive() : drive;
|
||||
}
|
||||
|
||||
public void setDrive(Drive drive) {
|
||||
this.drive = drive;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Init.execute(() -> Path.write(AliYun.get().getCache(), toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new Gson().toJson(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Code {
|
||||
|
||||
@SerializedName("redirectUri")
|
||||
private String redirectUri;
|
||||
|
||||
public static Code objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Code.class);
|
||||
}
|
||||
|
||||
public String getRedirectUri() {
|
||||
return TextUtils.isEmpty(redirectUri) ? "" : redirectUri;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return getRedirectUri().split("code=")[1];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Data {
|
||||
|
||||
@SerializedName("data")
|
||||
private Data data;
|
||||
@SerializedName("content")
|
||||
private Data content;
|
||||
@SerializedName("t")
|
||||
private String t;
|
||||
@SerializedName("ck")
|
||||
private String ck;
|
||||
@SerializedName("codeContent")
|
||||
private String codeContent;
|
||||
@SerializedName("qrCodeStatus")
|
||||
private String qrCodeStatus;
|
||||
@SerializedName("bizExt")
|
||||
private String bizExt;
|
||||
|
||||
public static Data objectFrom(String str) {
|
||||
try {
|
||||
Data data = new Gson().fromJson(str, Data.class);
|
||||
return data == null ? new Data() : data;
|
||||
} catch (Exception e) {
|
||||
return new Data();
|
||||
}
|
||||
}
|
||||
|
||||
public Data getData() {
|
||||
return data == null ? new Data() : data;
|
||||
}
|
||||
|
||||
public Data getContent() {
|
||||
return content == null ? new Data() : content;
|
||||
}
|
||||
|
||||
public String getT() {
|
||||
return t == null ? "" : t;
|
||||
}
|
||||
|
||||
public String getCk() {
|
||||
return ck == null ? "" : ck;
|
||||
}
|
||||
|
||||
public String getCodeContent() {
|
||||
return codeContent == null ? "" : codeContent;
|
||||
}
|
||||
|
||||
public String getQrCodeStatus() {
|
||||
return qrCodeStatus == null ? "" : qrCodeStatus;
|
||||
}
|
||||
|
||||
public String getBizExt() {
|
||||
return bizExt == null ? "" : bizExt;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return Biz.objectFrom(new String(Base64.decode(getBizExt(), Base64.DEFAULT))).getPdsLoginResult().getRefreshToken();
|
||||
}
|
||||
|
||||
public boolean hasToken() {
|
||||
return getQrCodeStatus().equals("CONFIRMED") && getBizExt().length() > 0;
|
||||
}
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("t", getT());
|
||||
params.put("ck", getCk());
|
||||
params.put("appName", "aliyun_drive");
|
||||
params.put("appEntrance", "web");
|
||||
params.put("isMobile", "false");
|
||||
params.put("lang", "zh_CN");
|
||||
params.put("returnUrl", "");
|
||||
params.put("fromSite", "52");
|
||||
params.put("bizParams", "");
|
||||
params.put("navlanguage", "zh-CN");
|
||||
params.put("navPlatform", "MacIntel");
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Download {
|
||||
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
@SerializedName("file_id")
|
||||
private String fileId;
|
||||
@SerializedName("expiration")
|
||||
private String expiration;
|
||||
|
||||
public static Download objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Download.class);
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return TextUtils.isEmpty(url) ? "" : url;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return TextUtils.isEmpty(fileId) ? "" : fileId;
|
||||
}
|
||||
|
||||
public String getExpiration() {
|
||||
return TextUtils.isEmpty(expiration) ? "" : expiration;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Drive {
|
||||
|
||||
@SerializedName("default_drive_id")
|
||||
private String defaultDriveId;
|
||||
@SerializedName("resource_drive_id")
|
||||
private String resourceDriveId;
|
||||
|
||||
public static Drive objectFrom(String str) {
|
||||
Drive item = new Gson().fromJson(str, Drive.class);
|
||||
return item == null ? new Drive() : item;
|
||||
}
|
||||
|
||||
private String getDefaultDriveId() {
|
||||
return TextUtils.isEmpty(defaultDriveId) ? "" : defaultDriveId;
|
||||
}
|
||||
|
||||
private String getResourceDriveId() {
|
||||
return TextUtils.isEmpty(resourceDriveId) ? "" : resourceDriveId;
|
||||
}
|
||||
|
||||
public String getDriveId() {
|
||||
return getResourceDriveId().isEmpty() ? getDefaultDriveId() : getResourceDriveId();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.utils.Util;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Item implements Comparable<Item> {
|
||||
|
||||
@SerializedName("items")
|
||||
private List<Item> items;
|
||||
@SerializedName("next_marker")
|
||||
private String nextMarker;
|
||||
@SerializedName("file_id")
|
||||
private String fileId;
|
||||
@SerializedName("share_id")
|
||||
private String shareId;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
@SerializedName("file_extension")
|
||||
private String fileExtension;
|
||||
@SerializedName("category")
|
||||
private String category;
|
||||
@SerializedName("size")
|
||||
private double size;
|
||||
@SerializedName("parent")
|
||||
private String parent;
|
||||
|
||||
public static Item objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Item.class);
|
||||
}
|
||||
|
||||
public Item(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items == null ? Collections.emptyList() : items;
|
||||
}
|
||||
|
||||
public String getNextMarker() {
|
||||
return TextUtils.isEmpty(nextMarker) ? "" : nextMarker;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return TextUtils.isEmpty(fileId) ? "" : fileId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return TextUtils.isEmpty(type) ? "" : type;
|
||||
}
|
||||
|
||||
public String getExt() {
|
||||
return TextUtils.isEmpty(fileExtension) ? "" : fileExtension;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return TextUtils.isEmpty(category) ? "" : category;
|
||||
}
|
||||
|
||||
public String getSize() {
|
||||
return size == 0 ? "" : "[" + Util.getSize(size) + "]";
|
||||
}
|
||||
|
||||
public String getParent() {
|
||||
return TextUtils.isEmpty(parent) ? "" : "[" + parent + "]";
|
||||
}
|
||||
|
||||
public Item parent(String parent) {
|
||||
this.parent = parent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return TextUtils.join(" ", Arrays.asList(getParent(), getName(), getSize())).trim();
|
||||
}
|
||||
|
||||
public String getSortName() {
|
||||
return TextUtils.join(" ", Arrays.asList(getParent(), Util.getDigit(getName()))).trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Item item) {
|
||||
return getSortName().compareTo(item.getSortName());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class OAuth {
|
||||
|
||||
@SerializedName("token_type")
|
||||
private String tokenType;
|
||||
@SerializedName("access_token")
|
||||
private String accessToken;
|
||||
@SerializedName("refresh_token")
|
||||
private String refreshToken;
|
||||
|
||||
public static OAuth objectFrom(String str) {
|
||||
OAuth item = new Gson().fromJson(str, OAuth.class);
|
||||
return item == null ? new OAuth() : item;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return TextUtils.isEmpty(tokenType) ? "" : tokenType;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return TextUtils.isEmpty(accessToken) ? "" : accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return TextUtils.isEmpty(refreshToken) ? "" : refreshToken;
|
||||
}
|
||||
|
||||
public String getAuthorization() {
|
||||
return getTokenType() + " " + getAccessToken();
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
this.refreshToken = "";
|
||||
this.accessToken = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Sub;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Preview {
|
||||
|
||||
@SerializedName("video_preview_play_info")
|
||||
private Info videoPreviewPlayInfo;
|
||||
@SerializedName("drive_id")
|
||||
private String driveId;
|
||||
@SerializedName("file_id")
|
||||
private String fileId;
|
||||
|
||||
public static Preview objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Preview.class);
|
||||
}
|
||||
|
||||
public Info getVideoPreviewPlayInfo() {
|
||||
return videoPreviewPlayInfo == null ? new Info() : videoPreviewPlayInfo;
|
||||
}
|
||||
|
||||
public String getDriveId() {
|
||||
return TextUtils.isEmpty(driveId) ? "" : driveId;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return TextUtils.isEmpty(fileId) ? "" : fileId;
|
||||
}
|
||||
|
||||
public static class Info {
|
||||
|
||||
@SerializedName("live_transcoding_task_list")
|
||||
private List<LiveTranscodingTask> liveTranscodingTaskList;
|
||||
@SerializedName("live_transcoding_subtitle_task_list")
|
||||
private List<LiveTranscodingTask> liveTranscodingSubtitleTaskList;
|
||||
|
||||
public List<LiveTranscodingTask> getLiveTranscodingTaskList() {
|
||||
return liveTranscodingTaskList == null ? Collections.emptyList() : liveTranscodingTaskList;
|
||||
}
|
||||
|
||||
public List<LiveTranscodingTask> getLiveTranscodingSubtitleTaskList() {
|
||||
return liveTranscodingSubtitleTaskList == null ? Collections.emptyList() : liveTranscodingSubtitleTaskList;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LiveTranscodingTask {
|
||||
|
||||
@SerializedName("template_id")
|
||||
private String templateId;
|
||||
@SerializedName("language")
|
||||
private String language;
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
|
||||
public String getTemplateId() {
|
||||
return TextUtils.isEmpty(templateId) ? "" : templateId;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return TextUtils.isEmpty(language) ? "" : language;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return TextUtils.isEmpty(status) ? "" : status;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return TextUtils.isEmpty(url) ? "" : url;
|
||||
}
|
||||
|
||||
public Sub getSub() {
|
||||
return Sub.create().url(getUrl()).name(getLanguage()).lang(getLanguage()).ext("vtt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Resp {
|
||||
|
||||
@SerializedName("responses")
|
||||
private List<Resp> responses;
|
||||
@SerializedName("body")
|
||||
private Body body;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("status")
|
||||
private int status;
|
||||
|
||||
public static Resp objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Resp.class);
|
||||
}
|
||||
|
||||
public List<Resp> getResponses() {
|
||||
return responses == null ? Collections.emptyList() : responses;
|
||||
}
|
||||
|
||||
public Resp getResponse() {
|
||||
return getResponses().isEmpty() ? new Resp() : getResponses().get(0);
|
||||
}
|
||||
|
||||
public Body getBody() {
|
||||
return body == null ? new Body() : body;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return TextUtils.isEmpty(id) ? "" : id;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public static class Body {
|
||||
|
||||
@SerializedName("domain_id")
|
||||
private String domainId;
|
||||
@SerializedName("drive_id")
|
||||
private String driveId;
|
||||
@SerializedName("file_id")
|
||||
private String fileId;
|
||||
@SerializedName("code")
|
||||
private String code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
|
||||
public String getDomainId() {
|
||||
return TextUtils.isEmpty(domainId) ? "" : domainId;
|
||||
}
|
||||
|
||||
public String getDriveId() {
|
||||
return TextUtils.isEmpty(driveId) ? "" : driveId;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return TextUtils.isEmpty(fileId) ? "" : fileId;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return TextUtils.isEmpty(code) ? "" : code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return TextUtils.isEmpty(message) ? "" : message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Share {
|
||||
|
||||
@SerializedName("share_id")
|
||||
private String shareId;
|
||||
@SerializedName("share_token")
|
||||
private String shareToken;
|
||||
@SerializedName("expire_time")
|
||||
private String expireTime;
|
||||
@SerializedName("expires_in")
|
||||
private int expiresIn;
|
||||
|
||||
@SerializedName("creator_id")
|
||||
private String creatorId;
|
||||
@SerializedName("creator_name")
|
||||
private String creatorName;
|
||||
@SerializedName("creator_phone")
|
||||
private String creatorPhone;
|
||||
@SerializedName("expiration")
|
||||
private String expiration;
|
||||
@SerializedName("updated_at")
|
||||
private String updatedAt;
|
||||
@SerializedName("vip")
|
||||
private String vip;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("share_name")
|
||||
private String shareName;
|
||||
@SerializedName("display_name")
|
||||
private String displayName;
|
||||
@SerializedName("share_title")
|
||||
private String shareTitle;
|
||||
@SerializedName("has_pwd")
|
||||
private boolean hasPwd;
|
||||
@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;
|
||||
}
|
||||
|
||||
public String getExpireTime() {
|
||||
return TextUtils.isEmpty(expireTime) ? "" : expireTime;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public String getCreatorId() {
|
||||
return TextUtils.isEmpty(creatorId) ? "" : creatorId;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return TextUtils.isEmpty(creatorName) ? "" : creatorName;
|
||||
}
|
||||
|
||||
public String getCreatorPhone() {
|
||||
return TextUtils.isEmpty(creatorPhone) ? "" : creatorPhone;
|
||||
}
|
||||
|
||||
public String getExpiration() {
|
||||
return TextUtils.isEmpty(expiration) ? "" : expiration;
|
||||
}
|
||||
|
||||
public String getUpdatedAt() {
|
||||
return TextUtils.isEmpty(updatedAt) ? "" : updatedAt;
|
||||
}
|
||||
|
||||
public String getVip() {
|
||||
return TextUtils.isEmpty(vip) ? "" : vip;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return TextUtils.isEmpty(avatar) ? "" : avatar;
|
||||
}
|
||||
|
||||
public String getShareName() {
|
||||
return TextUtils.isEmpty(shareName) ? "" : shareName;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return TextUtils.isEmpty(displayName) ? "" : displayName;
|
||||
}
|
||||
|
||||
public String getShareTitle() {
|
||||
return TextUtils.isEmpty(shareTitle) ? "" : shareTitle;
|
||||
}
|
||||
|
||||
public boolean isHasPwd() {
|
||||
return hasPwd;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package com.github.catvod.bean.ali;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class User {
|
||||
|
||||
@SerializedName("token_type")
|
||||
private String tokenType;
|
||||
@SerializedName("access_token")
|
||||
private String accessToken;
|
||||
@SerializedName("refresh_token")
|
||||
private String refreshToken;
|
||||
|
||||
public static User objectFrom(String str) {
|
||||
User item = new Gson().fromJson(str, User.class);
|
||||
return item == null ? new User() : item;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return TextUtils.isEmpty(tokenType) ? "" : tokenType;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return TextUtils.isEmpty(accessToken) ? "" : accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return TextUtils.isEmpty(refreshToken) ? "" : refreshToken;
|
||||
}
|
||||
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public String getAuthorization() {
|
||||
return getTokenType() + " " + getAccessToken();
|
||||
}
|
||||
|
||||
public boolean isAuthed() {
|
||||
return getTokenType().length() > 0 && getAccessToken().length() > 0;
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
this.refreshToken = "";
|
||||
this.accessToken = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Card {
|
||||
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName(value = "img", alternate = "picurl")
|
||||
private String img;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("countStr")
|
||||
private String countStr;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
@SerializedName("cards")
|
||||
private List<Card> cards;
|
||||
|
||||
public static List<Card> arrayFrom(String str) {
|
||||
Type listType = new TypeToken<List<Card>>() {}.getType();
|
||||
return new Gson().fromJson(str, listType);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return TextUtils.isEmpty(img) ? "" : img;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return TextUtils.isEmpty(id) ? "" : id;
|
||||
}
|
||||
|
||||
public String getCountStr() {
|
||||
return TextUtils.isEmpty(countStr) ? "" : countStr;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return TextUtils.isEmpty(url) ? "" : url;
|
||||
}
|
||||
|
||||
public List<Card> getCards() {
|
||||
return cards == null ? Collections.emptyList() : cards;
|
||||
}
|
||||
|
||||
public Vod vod() {
|
||||
return new Vod(getId(), getName(), getImg(), getCountStr());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import com.github.catvod.bean.Filter;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Condition {
|
||||
|
||||
@SerializedName("label")
|
||||
private List<List<String>> label;
|
||||
@SerializedName("country")
|
||||
private List<String> country;
|
||||
@SerializedName("time")
|
||||
private List<Integer> time;
|
||||
|
||||
public static Condition objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Condition.class);
|
||||
}
|
||||
|
||||
public List<List<String>> getLabel() {
|
||||
return label == null ? Collections.emptyList() : label;
|
||||
}
|
||||
|
||||
public List<String> getCountry() {
|
||||
return country == null ? Collections.emptyList() : country;
|
||||
}
|
||||
|
||||
public List<Integer> getTime() {
|
||||
return time == null ? Collections.emptyList() : time;
|
||||
}
|
||||
|
||||
public List<Filter> getFilter() {
|
||||
List<Filter> filters = new ArrayList<>();
|
||||
filters.add(new Filter("type", "類型", getTypeValues()));
|
||||
filters.add(new Filter("area", "地區", getAreaValues()));
|
||||
filters.add(new Filter("year", "年份", getYearValues()));
|
||||
return filters;
|
||||
}
|
||||
|
||||
private List<Filter.Value> getTypeValues() {
|
||||
List<Filter.Value> values = new ArrayList<>();
|
||||
values.add(new Filter.Value("全部", ""));
|
||||
for (List<String> list : getLabel()) values.add(new Filter.Value(list.get(0)));
|
||||
return values;
|
||||
}
|
||||
|
||||
private List<Filter.Value> getAreaValues() {
|
||||
List<Filter.Value> values = new ArrayList<>();
|
||||
values.add(new Filter.Value("全部", ""));
|
||||
for (String text : getCountry()) values.add(new Filter.Value(text));
|
||||
return values;
|
||||
}
|
||||
|
||||
private List<Filter.Value> getYearValues() {
|
||||
List<Filter.Value> values = new ArrayList<>();
|
||||
values.add(new Filter.Value("全部", ""));
|
||||
Collections.sort(getTime(), Collections.reverseOrder());
|
||||
for (Integer year : getTime()) if (year >= 2010) values.add(new Filter.Value(String.valueOf(year)));
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Group {
|
||||
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("videos")
|
||||
private List<Video> videos;
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
||||
public List<Video> getVideos() {
|
||||
return videos == null ? Collections.emptyList() : videos;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Info {
|
||||
|
||||
@SerializedName("videosGroup")
|
||||
private List<Group> videosGroup;
|
||||
@SerializedName("actor")
|
||||
private List<Person> actor;
|
||||
@SerializedName("country")
|
||||
private String country;
|
||||
@SerializedName("desc")
|
||||
private String desc;
|
||||
@SerializedName("director")
|
||||
private List<Person> director;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("picurl")
|
||||
private String picurl;
|
||||
@SerializedName("time")
|
||||
private String time;
|
||||
@SerializedName("countStr")
|
||||
private String countStr;
|
||||
|
||||
public static Info objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Info.class);
|
||||
}
|
||||
|
||||
public List<Group> getVideosGroup() {
|
||||
return videosGroup == null ? Collections.emptyList() : videosGroup;
|
||||
}
|
||||
|
||||
public List<Person> getActor() {
|
||||
return actor == null ? Collections.emptyList() : actor;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return TextUtils.isEmpty(country) ? "" : country;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return TextUtils.isEmpty(desc) ? "" : desc;
|
||||
}
|
||||
|
||||
public List<Person> getDirector() {
|
||||
return director == null ? Collections.emptyList() : director;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
||||
public String getPicurl() {
|
||||
return TextUtils.isEmpty(picurl) ? "" : picurl;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return TextUtils.isEmpty(time) ? "" : time;
|
||||
}
|
||||
|
||||
public String getCountStr() {
|
||||
return TextUtils.isEmpty(countStr) ? "" : countStr;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Person {
|
||||
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Query {
|
||||
|
||||
@SerializedName("country")
|
||||
private String country;
|
||||
@SerializedName("label")
|
||||
private String label;
|
||||
@SerializedName("chName")
|
||||
private String chName;
|
||||
@SerializedName("startTime")
|
||||
private Integer startTime;
|
||||
@SerializedName("endTime")
|
||||
private Integer endTime;
|
||||
@SerializedName("pageSize")
|
||||
private Integer pageSize;
|
||||
@SerializedName("page")
|
||||
private Integer page;
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void setChName(String chName) {
|
||||
this.chName = chName;
|
||||
}
|
||||
|
||||
public void setStartTime(Integer startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Integer endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public void setPage(Integer page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
setStartTime(Integer.parseInt(year));
|
||||
setEndTime(Integer.parseInt(year));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new Gson().toJson(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package com.github.catvod.bean.star;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Video {
|
||||
|
||||
@SerializedName("purl")
|
||||
private String purl;
|
||||
@SerializedName("eporder")
|
||||
private int eporder;
|
||||
|
||||
public String getPurl() {
|
||||
return TextUtils.isEmpty(purl) ? "" : purl;
|
||||
}
|
||||
|
||||
public int getEporder() {
|
||||
return eporder;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.github.catvod.bean.upyun;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Data {
|
||||
|
||||
@SerializedName("result")
|
||||
private Data result;
|
||||
@SerializedName("items")
|
||||
private List<Item> items;
|
||||
|
||||
public static Data objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Data.class);
|
||||
}
|
||||
|
||||
public Data getResult() {
|
||||
return result == null ? new Data() : result;
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items == null ? Collections.emptyList() : items;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package com.github.catvod.bean.upyun;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Item {
|
||||
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
@SerializedName("page_url")
|
||||
private String pageUrl;
|
||||
@SerializedName("insert_time")
|
||||
private String insertTime;
|
||||
|
||||
public String getTitle() {
|
||||
return TextUtils.isEmpty(title) ? "" : title.replaceAll("<em>", "").replaceAll("</em>", "");
|
||||
}
|
||||
|
||||
public String getPageUrl() {
|
||||
return TextUtils.isEmpty(pageUrl) ? "" : pageUrl;
|
||||
}
|
||||
|
||||
public String getInsertTime() {
|
||||
return TextUtils.isEmpty(insertTime) ? "" : insertTime;
|
||||
}
|
||||
|
||||
public Item url(String pageUrl) {
|
||||
this.pageUrl = pageUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vod getVod() {
|
||||
return new Vod(getPageUrl(), getTitle(), "https://inews.gtimg.com/newsapp_bt/0/13263837859/1000", getInsertTime());
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import android.widget.Button;
|
|||
import com.github.catvod.R;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.spider.Init;
|
||||
import com.github.catvod.spider.PTT;
|
||||
import com.github.catvod.spider.Kanqiu;
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public class MainActivity extends Activity {
|
|||
private void initSpider() {
|
||||
try {
|
||||
Init.init(getApplicationContext());
|
||||
spider = new PTT();
|
||||
spider = new Kanqiu();
|
||||
spider.init(this, "");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
package com.github.catvod.js;
|
||||
|
||||
import com.github.catvod.utils.Notify;
|
||||
import com.whl.quickjs.wrapper.JSMethod;
|
||||
import com.whl.quickjs.wrapper.QuickJSContext;
|
||||
|
||||
public class Method {
|
||||
|
||||
private QuickJSContext ctx;
|
||||
|
||||
public Method(QuickJSContext ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
@JSMethod
|
||||
public void showToast(String msg) {
|
||||
Notify.show(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.api.AliYun;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author ColaMint & Adam & FongMi
|
||||
*/
|
||||
public class Ali extends Spider {
|
||||
|
||||
public static final Pattern pattern = Pattern.compile("(www.aliyundrive.com|www.alipan.com)/s/([^/]+)(/folder/([^/]+))?");
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
AliYun.get().setRefreshToken(extend);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
String id = ids.get(0).trim();
|
||||
Matcher matcher = pattern.matcher(id);
|
||||
return matcher.find() ? Result.string(parseVod(matcher, id)) : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||
return AliYun.get().playerContent(id.split("\\+"), flag);
|
||||
}
|
||||
|
||||
private Vod parseVod(Matcher matcher, String id) {
|
||||
String shareId = matcher.group(2);
|
||||
String fileId = matcher.groupCount() == 4 ? matcher.group(4) : "";
|
||||
return AliYun.get().getVod(id, shareId, fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 獲取詳情內容視頻播放來源(多 shared_link)
|
||||
*
|
||||
* @param ids share_link 集合
|
||||
* @return 詳情內容視頻播放來源
|
||||
*/
|
||||
public String detailContentVodPlayFrom(List<String> ids) {
|
||||
List<String> playFrom = new ArrayList<>();
|
||||
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));
|
||||
playFrom.add(String.format(Locale.getDefault(), "代理普畫#%02d", i));
|
||||
}
|
||||
return TextUtils.join("$$$", playFrom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 獲取詳情內容視頻播放地址(多 share_link)
|
||||
*
|
||||
* @param ids share_link 集合
|
||||
* @return 詳情內容視頻播放地址
|
||||
*/
|
||||
public String detailContentVodPlayUrl(List<String> ids) {
|
||||
List<String> playUrl = new ArrayList<>();
|
||||
for (String id : ids) {
|
||||
Matcher matcher = pattern.matcher(id);
|
||||
if (matcher.find()) playUrl.add(parseVod(matcher, id).getVodPlayUrl());
|
||||
}
|
||||
return TextUtils.join("$$$", playUrl);
|
||||
}
|
||||
|
||||
public static Object[] proxy(Map<String, String> params) throws Exception {
|
||||
String type = params.get("type");
|
||||
if ("video".equals(type)) return AliYun.get().proxyVideo(params);
|
||||
if ("sub".equals(type)) return AliYun.get().proxySub(params);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,820 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* M浏览器中的App影视
|
||||
* Author: 群友 不负此生
|
||||
*/
|
||||
public class AppYsV2 extends Spider {
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
super.init(context, extend);
|
||||
try {
|
||||
extInfos = extend.split("###");
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
String url = getCateUrl(getApiUrl());
|
||||
JSONArray jsonArray = null;
|
||||
if (!url.isEmpty()) {
|
||||
SpiderDebug.log(url);
|
||||
String json = OkHttp.string(url, getHeaders(url));
|
||||
JSONObject obj = new JSONObject(json);
|
||||
if (obj.has("list") && obj.get("list") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONArray("list");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONObject && obj.getJSONObject("data").has("list") && obj.getJSONObject("data").get("list") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONObject("data").getJSONArray("list");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONArray("data");
|
||||
}
|
||||
} else { // 通过filter列表读分类
|
||||
String filterStr = getFilterTypes(url, null);
|
||||
String[] classes = filterStr.split("\n")[0].split("\\+");
|
||||
jsonArray = new JSONArray();
|
||||
for (int i = 1; i < classes.length; i++) {
|
||||
String[] kv = classes[i].trim().split("=");
|
||||
if (kv.length < 2) continue;
|
||||
JSONObject newCls = new JSONObject();
|
||||
newCls.put("type_name", kv[0].trim());
|
||||
newCls.put("type_id", kv[1].trim());
|
||||
jsonArray.put(newCls);
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
JSONArray classes = new JSONArray();
|
||||
if (jsonArray != null) {
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject jObj = jsonArray.getJSONObject(i);
|
||||
String typeName = jObj.getString("type_name");
|
||||
String typeId = jObj.getString("type_id");
|
||||
JSONObject newCls = new JSONObject();
|
||||
newCls.put("type_id", typeId);
|
||||
newCls.put("type_name", typeName);
|
||||
JSONObject typeExtend = jObj.optJSONObject("type_extend");
|
||||
if (filter) {
|
||||
String filterStr = getFilterTypes(url, typeExtend);
|
||||
String[] filters = filterStr.split("\n");
|
||||
JSONArray filterArr = new JSONArray();
|
||||
for (int k = url.isEmpty() ? 1 : 0; k < filters.length; k++) {
|
||||
String l = filters[k].trim();
|
||||
if (l.isEmpty()) continue;
|
||||
String[] oneLine = l.split("\\+");
|
||||
String type = oneLine[0].trim();
|
||||
String typeN = type;
|
||||
if (type.contains("筛选")) {
|
||||
type = type.replace("筛选", "");
|
||||
switch (type) {
|
||||
case "class":
|
||||
typeN = "类型";
|
||||
break;
|
||||
case "area":
|
||||
typeN = "地区";
|
||||
break;
|
||||
case "lang":
|
||||
typeN = "语言";
|
||||
break;
|
||||
case "year":
|
||||
typeN = "年份";
|
||||
break;
|
||||
}
|
||||
}
|
||||
JSONObject jOne = new JSONObject();
|
||||
jOne.put("key", type);
|
||||
jOne.put("name", typeN);
|
||||
JSONArray valueArr = new JSONArray();
|
||||
for (int j = 1; j < oneLine.length; j++) {
|
||||
JSONObject kvo = new JSONObject();
|
||||
String kv = oneLine[j].trim();
|
||||
int sp = kv.indexOf("=");
|
||||
if (sp == -1) {
|
||||
kvo.put("n", kv);
|
||||
kvo.put("v", kv);
|
||||
} else {
|
||||
String n = kv.substring(0, sp);
|
||||
kvo.put("n", n.trim());
|
||||
kvo.put("v", kv.substring(sp + 1).trim());
|
||||
}
|
||||
valueArr.put(kvo);
|
||||
}
|
||||
jOne.put("value", valueArr);
|
||||
filterArr.put(jOne);
|
||||
}
|
||||
if (!result.has("filters")) {
|
||||
result.put("filters", new JSONObject());
|
||||
}
|
||||
result.getJSONObject("filters").put(typeId, filterArr);
|
||||
}
|
||||
classes.put(newCls);
|
||||
}
|
||||
}
|
||||
result.put("class", classes);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeVideoContent() throws Exception {
|
||||
String apiUrl = getApiUrl();
|
||||
String url = getRecommendUrl(apiUrl);
|
||||
boolean isTV = false;
|
||||
if (url.isEmpty()) {
|
||||
url = getCateFilterUrlPrefix(apiUrl) + "movie&page=1&area=&type=&start=";
|
||||
isTV = true;
|
||||
}
|
||||
SpiderDebug.log(url);
|
||||
String json = OkHttp.string(url, getHeaders(url));
|
||||
JSONObject obj = new JSONObject(json);
|
||||
JSONArray videos = new JSONArray();
|
||||
if (isTV) {
|
||||
JSONArray jsonArray = obj.getJSONArray("data");
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject vObj = jsonArray.getJSONObject(i);
|
||||
JSONObject v = new JSONObject();
|
||||
v.put("vod_id", vObj.getString("nextlink"));
|
||||
v.put("vod_name", vObj.getString("title"));
|
||||
v.put("vod_pic", vObj.getString("pic"));
|
||||
v.put("vod_remarks", vObj.getString("state"));
|
||||
videos.put(v);
|
||||
}
|
||||
} else {
|
||||
ArrayList<JSONArray> arrays = new ArrayList<>();
|
||||
findJsonArray(obj, "vlist", arrays);
|
||||
if (arrays.isEmpty()) {
|
||||
findJsonArray(obj, "vod_list", arrays);
|
||||
}
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (JSONArray jsonArray : arrays) {
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject vObj = jsonArray.getJSONObject(i);
|
||||
String vid = vObj.getString("vod_id");
|
||||
if (ids.contains(vid)) continue;
|
||||
ids.add(vid);
|
||||
JSONObject v = new JSONObject();
|
||||
v.put("vod_id", vid);
|
||||
v.put("vod_name", vObj.getString("vod_name"));
|
||||
v.put("vod_pic", vObj.getString("vod_pic"));
|
||||
v.put("vod_remarks", vObj.getString("vod_remarks"));
|
||||
videos.put(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("list", videos);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String apiUrl = getApiUrl();
|
||||
String url = getCateFilterUrlPrefix(apiUrl) + tid + getCateFilterUrlSuffix(apiUrl);
|
||||
url = url.replace("#PN#", pg);
|
||||
url = url.replace("筛选class", (extend != null && extend.containsKey("class")) ? extend.get("class") : "");
|
||||
url = url.replace("筛选area", (extend != null && extend.containsKey("area")) ? extend.get("area") : "");
|
||||
url = url.replace("筛选lang", (extend != null && extend.containsKey("lang")) ? extend.get("lang") : "");
|
||||
url = url.replace("筛选year", (extend != null && extend.containsKey("year")) ? extend.get("year") : "");
|
||||
url = url.replace("排序", (extend != null && extend.containsKey("排序")) ? extend.get("排序") : "");
|
||||
SpiderDebug.log(url);
|
||||
String json = OkHttp.string(url, getHeaders(url));
|
||||
JSONObject obj = new JSONObject(json);
|
||||
int totalPg = Integer.MAX_VALUE;
|
||||
try {
|
||||
if (obj.has("totalpage") && obj.get("totalpage") instanceof Integer) {
|
||||
totalPg = obj.getInt("totalpage");
|
||||
} else if (obj.has("pagecount") && obj.get("pagecount") instanceof Integer) {
|
||||
totalPg = obj.getInt("pagecount");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONObject && (obj.getJSONObject("data").has("total") && obj.getJSONObject("data").get("total") instanceof Integer && obj.getJSONObject("data").has("limit") && obj.getJSONObject("data").get("limit") instanceof Integer)) {
|
||||
int limit = obj.getJSONObject("data").getInt("limit");
|
||||
int total = obj.getJSONObject("data").getInt("total");
|
||||
totalPg = total % limit == 0 ? (total / limit) : (total / limit + 1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SpiderDebug.log(e);
|
||||
}
|
||||
|
||||
JSONArray jsonArray = null;
|
||||
JSONArray videos = new JSONArray();
|
||||
if (obj.has("list") && obj.get("list") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONArray("list");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONObject && obj.getJSONObject("data").has("list") && obj.getJSONObject("data").get("list") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONObject("data").getJSONArray("list");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONArray("data");
|
||||
}
|
||||
if (jsonArray != null) {
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject vObj = jsonArray.getJSONObject(i);
|
||||
if (vObj.has("vod_id")) {
|
||||
JSONObject v = new JSONObject();
|
||||
v.put("vod_id", vObj.getString("vod_id"));
|
||||
v.put("vod_name", vObj.getString("vod_name"));
|
||||
v.put("vod_pic", vObj.getString("vod_pic"));
|
||||
v.put("vod_remarks", vObj.getString("vod_remarks"));
|
||||
videos.put(v);
|
||||
} else {
|
||||
JSONObject v = new JSONObject();
|
||||
v.put("vod_id", vObj.getString("nextlink"));
|
||||
v.put("vod_name", vObj.getString("title"));
|
||||
v.put("vod_pic", vObj.getString("pic"));
|
||||
v.put("vod_remarks", vObj.getString("state"));
|
||||
videos.put(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("page", pg);
|
||||
result.put("pagecount", totalPg);
|
||||
result.put("limit", 90);
|
||||
result.put("total", Integer.MAX_VALUE);
|
||||
result.put("list", videos);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
String apiUrl = getApiUrl();
|
||||
String url = getPlayUrlPrefix(apiUrl) + ids.get(0);
|
||||
SpiderDebug.log(url);
|
||||
String json = OkHttp.string(url, getHeaders(url));
|
||||
JSONObject obj = new JSONObject(json);
|
||||
JSONObject result = new JSONObject();
|
||||
JSONObject vod = new JSONObject();
|
||||
genPlayList(apiUrl, obj, json, vod, ids.get(0));
|
||||
JSONArray list = new JSONArray();
|
||||
list.put(vod);
|
||||
result.put("list", list);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String apiUrl = getApiUrl();
|
||||
String url = getSearchUrl(apiUrl, URLEncoder.encode(key));
|
||||
String json = OkHttp.string(url, getHeaders(url));
|
||||
JSONObject obj = new JSONObject(json);
|
||||
JSONArray jsonArray = null;
|
||||
JSONArray videos = new JSONArray();
|
||||
if (obj.has("list") && obj.get("list") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONArray("list");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONObject && obj.getJSONObject("data").has("list") && obj.getJSONObject("data").get("list") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONObject("data").getJSONArray("list");
|
||||
} else if (obj.has("data") && obj.get("data") instanceof JSONArray) {
|
||||
jsonArray = obj.getJSONArray("data");
|
||||
}
|
||||
if (jsonArray != null) {
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject vObj = jsonArray.getJSONObject(i);
|
||||
if (vObj.has("vod_id")) {
|
||||
JSONObject v = new JSONObject();
|
||||
v.put("vod_id", vObj.getString("vod_id"));
|
||||
v.put("vod_name", vObj.getString("vod_name"));
|
||||
v.put("vod_pic", vObj.getString("vod_pic"));
|
||||
v.put("vod_remarks", vObj.getString("vod_remarks"));
|
||||
videos.put(v);
|
||||
} else {
|
||||
JSONObject v = new JSONObject();
|
||||
v.put("vod_id", vObj.getString("nextlink"));
|
||||
v.put("vod_name", vObj.getString("title"));
|
||||
v.put("vod_pic", vObj.getString("pic"));
|
||||
v.put("vod_remarks", vObj.getString("state"));
|
||||
videos.put(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("list", videos);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
if (flag.contains("fanqie") && Util.isVideoFormat(id)) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("parse", 0);
|
||||
result.put("playUrl", "");
|
||||
result.put("url", id);
|
||||
return result.toString();
|
||||
}
|
||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
||||
if (parseUrls == null) parseUrls = new ArrayList<>();
|
||||
if (!parseUrls.isEmpty()) {
|
||||
JSONObject result = getFinalVideo(flag, parseUrls, id);
|
||||
if (result != null) return result.toString();
|
||||
}
|
||||
if (Util.isVideoFormat(id)) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("parse", 0);
|
||||
result.put("playUrl", "");
|
||||
result.put("url", id);
|
||||
return result.toString();
|
||||
} else {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("parse", 1);
|
||||
result.put("jx", "1");
|
||||
result.put("url", id);
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private void findJsonArray(JSONObject obj, String match, ArrayList<JSONArray> result) {
|
||||
Iterator<String> keys = obj.keys();
|
||||
while (keys.hasNext()) {
|
||||
String k = keys.next();
|
||||
try {
|
||||
Object o = obj.get(k);
|
||||
if (k.equals(match) && o instanceof JSONArray) result.add((JSONArray) o);
|
||||
if (o instanceof JSONObject) {
|
||||
findJsonArray((JSONObject) o, match, result);
|
||||
} else if (o instanceof JSONArray) {
|
||||
JSONArray array = (JSONArray) o;
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
findJsonArray(array.getJSONObject(i), match, result);
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
SpiderDebug.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String jsonArr2Str(JSONArray array) {
|
||||
try {
|
||||
ArrayList<String> strings = new ArrayList<>();
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
strings.add(array.getString(i));
|
||||
}
|
||||
return TextUtils.join(",", strings);
|
||||
} catch (JSONException e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, String> getHeaders(String URL) {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", UA(URL));
|
||||
return headers;
|
||||
}
|
||||
|
||||
// M 扩展方法
|
||||
// ######重组搜索
|
||||
private String getSearchUrl(String URL, String KEY) {
|
||||
if (URL.contains(".vod")) {
|
||||
if (URL.contains("iopenyun.com")) {
|
||||
return URL + "/list?wd=" + KEY + "&page=";
|
||||
} else {
|
||||
return URL + "?wd=" + KEY + "&page=";
|
||||
}
|
||||
} else if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
return URL + "search?text=" + KEY + "&pg=";
|
||||
} else if (urlPattern1.matcher(URL).find()) {
|
||||
if (URL.contains("esellauto") || URL.contains("1.14.63.101") || URL.contains("zjys") || URL.contains("dcd") || URL.contains("lxue") || URL.contains("weetai.cn") || URL.contains("haokanju1") || URL.contains("fit:8") || URL.contains("zjj.life") || URL.contains("love9989") || URL.contains("8d8q") || URL.contains("lk.pxun") || URL.contains("hgyx") || URL.contains("521x5") || URL.contains("lxyyy") || URL.contains("0818tv") || URL.contains("diyoui") || URL.contains("diliktv") || URL.contains("ppzhu") || URL.contains("aitesucai") || URL.contains("zz.ci") || URL.contains("chxjon") || URL.contains("watchmi") || URL.contains("vipbp") || URL.contains("bhtv") || URL.contains("xfykl")) {
|
||||
return URL + "?ac=list&" + "wd=" + KEY + "&page=";
|
||||
} else {
|
||||
return URL + "?ac=list&" + "zm=" + KEY + "&page=";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// ######UA
|
||||
private static final Pattern urlPattern1 = Pattern.compile("api\\.php/.*?/vod");
|
||||
private static final Pattern urlPattern2 = Pattern.compile("api\\.php/.+?\\.vod");
|
||||
private static final Pattern parsePattern = Pattern.compile("/.+\\?.+=");
|
||||
private static final Pattern parsePattern1 = Pattern.compile(".*(url|v|vid|php\\?id)=");
|
||||
private static final Pattern parsePattern2 = Pattern.compile("https?://[^/]*");
|
||||
|
||||
protected static final Pattern[] htmlVideoKeyMatch = new Pattern[]{Pattern.compile("player=new"), Pattern.compile("<div id=\"video\""), Pattern.compile("<div id=\"[^\"]*?player\""), Pattern.compile("//视频链接"), Pattern.compile("HlsJsPlayer\\("), Pattern.compile("<iframe[\\s\\S]*?src=\"[^\"]+?\""), Pattern.compile("<video[\\s\\S]*?src=\"[^\"]+?\"")};
|
||||
|
||||
private String UA(String URL) {
|
||||
if (URL.contains("vod.9e03.com")) {
|
||||
return "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36";
|
||||
} else if (URL.contains("api.php/app") || URL.contains("xgapp") || URL.contains("freekan")) {
|
||||
return "Dart/2.14 (dart:io)";
|
||||
} else if (URL.contains("zsb") || URL.contains("fkxs") || URL.contains("xays") || URL.contains("xcys") || URL.contains("szys") || URL.contains("dxys") || URL.contains("ytys") || URL.contains("qnys")) {
|
||||
return "Dart/2.15 (dart:io)";
|
||||
} else if (URL.contains(".vod")) {
|
||||
return "okhttp/4.1.0";
|
||||
} else {
|
||||
return "Dalvik/2.1.0";
|
||||
}
|
||||
}
|
||||
|
||||
// ######获取分类地址
|
||||
String getCateUrl(String URL) {
|
||||
if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
return URL + "nav?token=";
|
||||
} else if (URL.contains(".vod")) {
|
||||
if (URL.contains("iopenyun.com")) {
|
||||
return URL + "/list?type";
|
||||
} else {
|
||||
return URL + "/types";
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// ######分类筛选前缀地址
|
||||
String getCateFilterUrlPrefix(String URL) {
|
||||
if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
if (URL.contains("dijiaxia")) {
|
||||
URL = "http://www.dijiaxia.com/api.php/app/";
|
||||
return URL + "video?tid=";
|
||||
} else {
|
||||
return URL + "video?tid=";
|
||||
}
|
||||
} else if (URL.contains(".vod")) {
|
||||
if (URL.contains("tv.bulei.cc")) {
|
||||
return "https://tv.bulei.cc/api2.php/v1.vod?type=";
|
||||
}
|
||||
if (URL.contains("iopenyun")) {
|
||||
return URL + "/list?type=";
|
||||
} else {
|
||||
return URL + "?type=";
|
||||
}
|
||||
} else {
|
||||
return URL + "?ac=list&class=";
|
||||
}
|
||||
}
|
||||
|
||||
// ######分类筛选后缀地址
|
||||
String getCateFilterUrlSuffix(String URL) {
|
||||
if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
return "&class=筛选class&area=筛选area&lang=筛选lang&year=筛选year&limit=18&pg=#PN#";
|
||||
} else if (URL.contains(".vod")) {
|
||||
return "&class=筛选class&area=筛选area&lang=筛选lang&year=筛选year&by=排序&limit=18&page=#PN#";
|
||||
} else {
|
||||
return "&page=#PN#&area=筛选area&type=筛选class&start=筛选year";
|
||||
}
|
||||
}
|
||||
|
||||
// ######筛选内容
|
||||
String getFilterTypes(String URL, JSONObject typeExtend) {
|
||||
String str = "";
|
||||
if (typeExtend != null) {
|
||||
Iterator<String> typeExtendKeys = typeExtend.keys();
|
||||
while (typeExtendKeys.hasNext()) {
|
||||
String key = typeExtendKeys.next();
|
||||
if (key.equals("class") || key.equals("area") || key.equals("lang") || key.equals("year")) {
|
||||
try {
|
||||
str = str + "筛选" + key + "+全部=+" + typeExtend.getString(key).replace(",", "+") + "\n";
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (URL.contains(".vod")) {
|
||||
str += "\n" + "排序+全部=+最新=time+最热=hits+评分=score";
|
||||
} else if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
} else {
|
||||
str = "分类+全部=+电影=movie+连续剧=tvplay+综艺=tvshow+动漫=comic+4K=movie_4k+体育=tiyu\n筛选class+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+惊悚+伦理+情色+福利+三级+儿童+网络电影\n筛选area+全部=+大陆+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n筛选year+全部=+2023+2022+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// ######推荐地址
|
||||
String getRecommendUrl(String URL) {
|
||||
if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
return URL + "index_video?token=";
|
||||
} else if (URL.contains(".vod")) {
|
||||
return URL + "/vodPhbAll";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// ######播放器前缀地址
|
||||
String getPlayUrlPrefix(String URL) {
|
||||
if (URL.contains("api.php/app") || URL.contains("xgapp")) {
|
||||
if (URL.contains("dijiaxia")) {
|
||||
URL = "https://www.dijiaxia.com/api.php/app/";
|
||||
return URL + "video_detail?id=";
|
||||
} else if (URL.contains("1010dy")) {
|
||||
URL = "http://www.1010dy.cc/api.php/app/";
|
||||
return URL + "video_detail?id=";
|
||||
} else {
|
||||
return URL + "video_detail?id=";
|
||||
}
|
||||
} else if (URL.contains(".vod")) {
|
||||
if (URL.contains("iopenyun")) {
|
||||
return URL + "/detailID?vod_id=";
|
||||
} else {
|
||||
return URL + "/detail?vod_id=";
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// ######选集
|
||||
protected final HashMap<String, ArrayList<String>> parseUrlMap = new HashMap<>();
|
||||
|
||||
private void genPlayList(String URL, JSONObject object, String json, JSONObject vod, String vid) throws JSONException {
|
||||
ArrayList<String> playUrls = new ArrayList<>();
|
||||
ArrayList<String> playFlags = new ArrayList<>();
|
||||
if (URL.contains("api.php/app/")) {
|
||||
JSONObject data = object.getJSONObject("data");
|
||||
vod.put("vod_id", data.optString("vod_id", vid));
|
||||
vod.put("vod_name", data.getString("vod_name"));
|
||||
vod.put("vod_pic", data.getString("vod_pic"));
|
||||
vod.put("type_name", data.optString("vod_class"));
|
||||
vod.put("vod_year", data.optString("vod_year"));
|
||||
vod.put("vod_area", data.optString("vod_area"));
|
||||
vod.put("vod_remarks", data.optString("vod_remarks"));
|
||||
vod.put("vod_actor", data.optString("vod_actor"));
|
||||
vod.put("vod_director", data.optString("vod_director"));
|
||||
vod.put("vod_content", data.optString("vod_content"));
|
||||
JSONArray vodUrlWithPlayer = data.getJSONArray("vod_url_with_player");
|
||||
for (int i = 0; i < vodUrlWithPlayer.length(); i++) {
|
||||
JSONObject from = vodUrlWithPlayer.getJSONObject(i);
|
||||
String flag = from.optString("code").trim();
|
||||
if (flag.isEmpty()) flag = from.getString("name").trim();
|
||||
playFlags.add(flag);
|
||||
playUrls.add(from.getString("url"));
|
||||
String purl = from.optString("parse_api").trim();
|
||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
||||
if (parseUrls == null) {
|
||||
parseUrls = new ArrayList<>();
|
||||
parseUrlMap.put(flag, parseUrls);
|
||||
}
|
||||
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
||||
}
|
||||
} else if (URL.contains("xgapp")) {
|
||||
JSONObject data = object.getJSONObject("data").getJSONObject("vod_info");
|
||||
vod.put("vod_id", data.optString("vod_id", vid));
|
||||
vod.put("vod_name", data.getString("vod_name"));
|
||||
vod.put("vod_pic", data.getString("vod_pic"));
|
||||
vod.put("type_name", data.optString("vod_class"));
|
||||
vod.put("vod_year", data.optString("vod_year"));
|
||||
vod.put("vod_area", data.optString("vod_area"));
|
||||
vod.put("vod_remarks", data.optString("vod_remarks"));
|
||||
vod.put("vod_actor", data.optString("vod_actor"));
|
||||
vod.put("vod_director", data.optString("vod_director"));
|
||||
vod.put("vod_content", data.optString("vod_content"));
|
||||
JSONArray vodUrlWithPlayer = data.getJSONArray("vod_url_with_player");
|
||||
for (int i = 0; i < vodUrlWithPlayer.length(); i++) {
|
||||
JSONObject from = vodUrlWithPlayer.getJSONObject(i);
|
||||
String flag = from.optString("code").trim();
|
||||
if (flag.isEmpty()) flag = from.getString("name").trim();
|
||||
playFlags.add(flag);
|
||||
playUrls.add(from.getString("url"));
|
||||
String purl = from.optString("parse_api").trim();
|
||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
||||
if (parseUrls == null) {
|
||||
parseUrls = new ArrayList<>();
|
||||
parseUrlMap.put(flag, parseUrls);
|
||||
}
|
||||
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
||||
}
|
||||
} else if (/*urlPattern2.matcher(URL).find()*/URL.contains(".vod")) {
|
||||
JSONObject data = object.getJSONObject("data");
|
||||
vod.put("vod_id", data.optString("vod_id", vid));
|
||||
vod.put("vod_name", data.getString("vod_name"));
|
||||
vod.put("vod_pic", data.getString("vod_pic"));
|
||||
vod.put("type_name", data.optString("vod_class"));
|
||||
vod.put("vod_year", data.optString("vod_year"));
|
||||
vod.put("vod_area", data.optString("vod_area"));
|
||||
vod.put("vod_remarks", data.optString("vod_remarks"));
|
||||
vod.put("vod_actor", data.optString("vod_actor"));
|
||||
vod.put("vod_director", data.optString("vod_director"));
|
||||
vod.put("vod_content", data.optString("vod_content"));
|
||||
JSONArray vodUrlWithPlayer = data.getJSONArray("vod_play_list");
|
||||
for (int i = 0; i < vodUrlWithPlayer.length(); i++) {
|
||||
JSONObject from = vodUrlWithPlayer.getJSONObject(i);
|
||||
String flag = from.getJSONObject("player_info").optString("from").trim();
|
||||
if (flag.isEmpty()) flag = from.getJSONObject("player_info").optString("show").trim();
|
||||
playFlags.add(flag);
|
||||
playUrls.add(from.getString("url"));
|
||||
try {
|
||||
ArrayList<String> parses = new ArrayList<>();
|
||||
String[] parse1 = from.getJSONObject("player_info").optString("parse").split(",");
|
||||
String[] parse2 = from.getJSONObject("player_info").optString("parse2").split(",");
|
||||
parses.addAll(Arrays.asList(parse1));
|
||||
parses.addAll(Arrays.asList(parse2));
|
||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
||||
if (parseUrls == null) {
|
||||
parseUrls = new ArrayList<>();
|
||||
parseUrlMap.put(flag, parseUrls);
|
||||
}
|
||||
for (String purl : parses) {
|
||||
if (purl.contains("http")) {
|
||||
Matcher matcher = parsePattern1.matcher(purl);
|
||||
if (matcher.find()) {
|
||||
purl = matcher.group(0);
|
||||
}
|
||||
} else if (purl.contains("//")) {
|
||||
Matcher matcher = parsePattern1.matcher(purl);
|
||||
if (matcher.find()) {
|
||||
purl = "http:" + matcher.group(0);
|
||||
}
|
||||
} else {
|
||||
Matcher matcher = parsePattern2.matcher(URL);
|
||||
if (matcher.find()) {
|
||||
Matcher matcher1 = parsePattern1.matcher(URL);
|
||||
if (matcher1.find()) {
|
||||
purl = matcher.group(0) + matcher1.group(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
purl = purl.replace("..", ".").trim();
|
||||
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SpiderDebug.log(e);
|
||||
}
|
||||
}
|
||||
} else if (urlPattern1.matcher(URL).find()) {
|
||||
JSONObject data = object;
|
||||
vod.put("vod_id", data.optString("vod_id", vid));
|
||||
vod.put("vod_name", data.getString("title"));
|
||||
vod.put("vod_pic", data.getString("img_url"));
|
||||
vod.put("type_name", jsonArr2Str(data.optJSONArray("type")));
|
||||
vod.put("vod_year", data.optString("pubtime"));
|
||||
vod.put("vod_area", jsonArr2Str(data.optJSONArray("area")));
|
||||
vod.put("vod_remarks", data.optString("trunk"));
|
||||
vod.put("vod_actor", jsonArr2Str(data.optJSONArray("actor")));
|
||||
vod.put("vod_director", jsonArr2Str(data.optJSONArray("director")));
|
||||
vod.put("vod_content", data.optString("intro"));
|
||||
JSONObject playList = data.getJSONObject("videolist");
|
||||
Iterator<String> playListKeys = playList.keys();
|
||||
while (playListKeys.hasNext()) {
|
||||
String flag = playListKeys.next();
|
||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
||||
if (parseUrls == null) {
|
||||
parseUrls = new ArrayList<>();
|
||||
parseUrlMap.put(flag, parseUrls);
|
||||
}
|
||||
JSONArray playListUrls = playList.getJSONArray(flag);
|
||||
ArrayList<String> urls = new ArrayList<>();
|
||||
for (int j = 0; j < playListUrls.length(); j++) {
|
||||
JSONObject urlObj = playListUrls.getJSONObject(j);
|
||||
String url = urlObj.getString("url");
|
||||
if (url.contains("url=")) {
|
||||
int spIdx = url.indexOf("url=") + 4;
|
||||
String pUrl = url.substring(0, spIdx).trim();
|
||||
if (!pUrl.isEmpty() && !parseUrls.contains(pUrl)) parseUrls.add(pUrl);
|
||||
urls.add(urlObj.getString("title") + "$" + url.substring(spIdx).trim());
|
||||
} else {
|
||||
urls.add(urlObj.getString("title") + "$" + url);
|
||||
}
|
||||
}
|
||||
playFlags.add(flag);
|
||||
playUrls.add(TextUtils.join("#", urls));
|
||||
}
|
||||
}
|
||||
vod.put("vod_play_from", TextUtils.join("$$$", playFlags));
|
||||
vod.put("vod_play_url", TextUtils.join("$$$", playUrls));
|
||||
}
|
||||
|
||||
// ######视频地址
|
||||
protected JSONObject getFinalVideo(String flag, ArrayList<String> parseUrls, String url) throws JSONException {
|
||||
String htmlPlayUrl = "";
|
||||
for (String parseUrl : parseUrls) {
|
||||
if (parseUrl.isEmpty() || parseUrl.equals("null")) continue;
|
||||
String playUrl = parseUrl + url;
|
||||
String content = OkHttp.string(playUrl);
|
||||
JSONObject tryJson = null;
|
||||
try {
|
||||
tryJson = jsonParse(url, content);
|
||||
} catch (Throwable th) {
|
||||
|
||||
}
|
||||
if (tryJson != null && tryJson.has("url") && tryJson.has("header")) {
|
||||
tryJson.put("header", tryJson.getJSONObject("header").toString());
|
||||
return tryJson;
|
||||
}
|
||||
if (content.contains("<html")) {
|
||||
boolean sniffer = false;
|
||||
for (Pattern p : htmlVideoKeyMatch) {
|
||||
if (p.matcher(content).find()) {
|
||||
sniffer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sniffer) {
|
||||
htmlPlayUrl = parseUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!htmlPlayUrl.isEmpty()) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("parse", 1);
|
||||
result.put("playUrl", htmlPlayUrl);
|
||||
result.put("url", url);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean manualVideoCheck() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVideoFormat(String url) {
|
||||
return Util.isVideoFormat(url);
|
||||
}
|
||||
|
||||
private String getApiUrl() {
|
||||
if (extInfos == null || extInfos.length < 1) return "";
|
||||
return extInfos[0].trim();
|
||||
}
|
||||
|
||||
private String[] extInfos = null;
|
||||
|
||||
public static JSONObject jsonParse(String input, String json) throws JSONException {
|
||||
//处理解析接口返回的报文,如果返回的报文中包含header信息,就加到返回值中
|
||||
JSONObject jsonPlayData = new JSONObject(json);
|
||||
if (jsonPlayData.has("data") && jsonPlayData.get("data") instanceof JSONObject && !jsonPlayData.has("url")) {
|
||||
jsonPlayData = jsonPlayData.getJSONObject("data");
|
||||
}
|
||||
String url = jsonPlayData.getString("url");
|
||||
if (url.startsWith("//")) {
|
||||
url = "https:" + url;
|
||||
}
|
||||
if (!url.trim().startsWith("http")) {
|
||||
return null;
|
||||
}
|
||||
if (url.equals(input)) {
|
||||
if (Util.isVip(url) || !Util.isVideoFormat(url)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (Util.isBlackVodUrl(url)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject headers = new JSONObject();
|
||||
if (jsonPlayData.has("header")) {
|
||||
headers = jsonPlayData.optJSONObject("header");
|
||||
} else if (jsonPlayData.has("Header")) {
|
||||
headers = jsonPlayData.optJSONObject("Header");
|
||||
} else if (jsonPlayData.has("headers")) {
|
||||
headers = jsonPlayData.optJSONObject("headers");
|
||||
} else if (jsonPlayData.has("Headers")) {
|
||||
headers = jsonPlayData.optJSONObject("Headers");
|
||||
}
|
||||
String ua = "";
|
||||
if (jsonPlayData.has("user-agent")) {
|
||||
ua = jsonPlayData.optString("user-agent", "");
|
||||
} else if (jsonPlayData.has("User-Agent")) {
|
||||
ua = jsonPlayData.optString("User-Agent", "");
|
||||
}
|
||||
if (ua.trim().length() > 0) {
|
||||
headers.put("User-Agent", " " + ua);
|
||||
}
|
||||
String referer = "";
|
||||
if (jsonPlayData.has("referer")) {
|
||||
referer = jsonPlayData.optString("referer", "");
|
||||
} else if (jsonPlayData.has("Referer")) {
|
||||
referer = jsonPlayData.optString("Referer", "");
|
||||
}
|
||||
if (referer.trim().length() > 0) {
|
||||
headers.put("Referer", " " + referer);
|
||||
}
|
||||
|
||||
headers = fixJsonVodHeader(headers, input, url);
|
||||
JSONObject taskResult = new JSONObject();
|
||||
taskResult.put("header", headers);
|
||||
taskResult.put("url", url);
|
||||
taskResult.put("parse", "0");
|
||||
return taskResult;
|
||||
}
|
||||
|
||||
public static JSONObject fixJsonVodHeader(JSONObject headers, String input, String url) throws JSONException {
|
||||
if (headers == null) headers = new JSONObject();
|
||||
if (input.contains("www.mgtv.com")) {
|
||||
headers.put("Referer", " ");
|
||||
headers.put("User-Agent", " Mozilla/5.0");
|
||||
} else if (url.contains("titan.mgtv")) {
|
||||
headers.put("Referer", " ");
|
||||
headers.put("User-Agent", " Mozilla/5.0");
|
||||
} else if (input.contains("bilibili")) {
|
||||
headers.put("Referer", " https://www.bilibili.com/");
|
||||
headers.put("User-Agent", " " + Util.CHROME);
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Json;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Douban extends Spider {
|
||||
|
||||
private final String siteUrl = "https://frodo.douban.com/api/v2";
|
||||
private final String apikey = "?apikey=0ac44ae016490db2204ce0a042db2916";
|
||||
private String extend;
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("Host", "frodo.douban.com");
|
||||
header.put("Connection", "Keep-Alive");
|
||||
header.put("Referer", "https://servicewechat.com/wx2f9b06c1de1ccfca/84/page-frame.html");
|
||||
header.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat");
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
this.extend = extend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("hot_gaia", "tv_hot", "show_hot", "movie", "tv", "rank_list_movie", "rank_list_tv");
|
||||
List<String> typeNames = Arrays.asList("热门电影", "热播剧集", "热播综艺", "电影筛选", "电视筛选", "电影榜单", "电视剧榜单");
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
String recommendUrl = "http://api.douban.com/api/v2/subject_collection/subject_real_time_hotest/items" + apikey;
|
||||
JSONObject jsonObject = new JSONObject(OkHttp.string(recommendUrl, getHeader()));
|
||||
JSONArray items = jsonObject.optJSONArray("subject_collection_items");
|
||||
return Result.string(classes, parseVodListFromJSONArray(items), filter ? Json.parse(OkHttp.string(extend)) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String sort = extend.get("sort") == null ? "T" : extend.get("sort");
|
||||
String tags = URLEncoder.encode(getTags(extend));
|
||||
int start = (Integer.parseInt(pg) - 1) * 20;
|
||||
String cateUrl;
|
||||
String itemKey = "items";
|
||||
switch (tid) {
|
||||
case "hot_gaia":
|
||||
sort = extend.get("sort") == null ? "recommend" : extend.get("sort");
|
||||
String area = extend.get("area") == null ? "全部" : extend.get("area");
|
||||
sort = sort + "&area=" + URLEncoder.encode(area);
|
||||
cateUrl = siteUrl + "/movie/hot_gaia" + apikey + "&sort=" + sort + "&start=" + start + "&count=20";
|
||||
break;
|
||||
case "tv_hot":
|
||||
String type = extend.get("type") == null ? "tv_hot" : extend.get("type");
|
||||
cateUrl = siteUrl + "/subject_collection/" + type + "/items" + apikey + "&start=" + start + "&count=20";
|
||||
itemKey = "subject_collection_items";
|
||||
break;
|
||||
case "show_hot":
|
||||
String showType = extend.get("type") == null ? "show_hot" : extend.get("type");
|
||||
cateUrl = siteUrl + "/subject_collection/" + showType + "/items" + apikey + "&start=" + start + "&count=20";
|
||||
itemKey = "subject_collection_items";
|
||||
break;
|
||||
case "tv":
|
||||
cateUrl = siteUrl + "/tv/recommend" + apikey + "&sort=" + sort + "&tags=" + tags + "&start=" + start + "&count=20";
|
||||
break;
|
||||
case "rank_list_movie":
|
||||
String rankMovieType = extend.get("榜单") == null ? "movie_real_time_hotest" : extend.get("榜单");
|
||||
cateUrl = siteUrl + "/subject_collection/" + rankMovieType + "/items" + apikey + "&start=" + start + "&count=20";
|
||||
itemKey = "subject_collection_items";
|
||||
break;
|
||||
case "rank_list_tv":
|
||||
String rankTVType = extend.get("榜单") == null ? "tv_real_time_hotest" : extend.get("榜单");
|
||||
cateUrl = siteUrl + "/subject_collection/" + rankTVType + "/items" + apikey + "&start=" + start + "&count=20";
|
||||
itemKey = "subject_collection_items";
|
||||
break;
|
||||
default:
|
||||
cateUrl = siteUrl + "/movie/recommend" + apikey + "&sort=" + sort + "&tags=" + tags + "&start=" + start + "&count=20";
|
||||
break;
|
||||
}
|
||||
JSONObject object = new JSONObject(OkHttp.string(cateUrl, getHeader()));
|
||||
JSONArray array = object.getJSONArray(itemKey);
|
||||
List<Vod> list = parseVodListFromJSONArray(array);
|
||||
int page = Integer.parseInt(pg), count = Integer.MAX_VALUE, limit = 20, total = Integer.MAX_VALUE;
|
||||
return Result.get().vod(list).page(page, count, limit, total).string();
|
||||
}
|
||||
|
||||
private List<Vod> parseVodListFromJSONArray(JSONArray items) throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
JSONObject item = items.getJSONObject(i);
|
||||
String vodId = "msearch:" + item.optString("id");
|
||||
String name = item.optString("title");
|
||||
String pic = getPic(item);
|
||||
String remark = getRating(item);
|
||||
list.add(new Vod(vodId, name, pic, remark));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private String getRating(JSONObject item) {
|
||||
try {
|
||||
return "评分:" + item.getJSONObject("rating").optString("value");
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String getPic(JSONObject item) {
|
||||
try {
|
||||
return item.getJSONObject("pic").optString("normal") + "@Referer=https://api.douban.com/@User-Agent=" + Util.CHROME;
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String getTags(HashMap<String, String> extend) {
|
||||
try {
|
||||
StringBuilder tags = new StringBuilder();
|
||||
for (String key : extend.keySet()) if (!key.equals("sort")) tags.append(extend.get(key)).append(",");
|
||||
return Util.substring(tags.toString());
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Qile
|
||||
*/
|
||||
public class FirstAid extends Spider {
|
||||
|
||||
private final String siteUrl = "https://m.youlai.cn";
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("jijiu|0", "jijiu|1", "jijiu|2", "jijiu|3", "jijiu|4", "jijiu|5", "jijiu|6", "jijiu|7");
|
||||
List<String> typeNames = Arrays.asList("急救技能", "家庭生活", "急危重症", "常见损伤", "动物致伤", "海洋急救", "中毒急救", "意外事故");
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
return Result.string(classes, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String[] item = tid.split("\\|");
|
||||
String id = item[0];
|
||||
String digit = item[1];
|
||||
int digitValue = Integer.parseInt(digit);
|
||||
String cateId = extend.get("cateId") == null ? id : extend.get("cateId");
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl + String.format("/%s", cateId), getHeader()));
|
||||
String pic = "https:" + doc.select(".block100").eq(digitValue).attr("src");
|
||||
Elements lis = doc.select(".jj-title-li").eq(digitValue).select(".list-br3");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : lis) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").text();
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.get().page(1, 1, 0, lis.size()).vod(list).string();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
Document doc = Jsoup.parse(OkHttp.string(ids.get(0), getHeader()));
|
||||
String title = doc.select(".video-title.h1-title").text();
|
||||
String pic = doc.select(".video-cover.list-flex-in img").attr("src");
|
||||
String actor = doc.select("span.doc-name").text();
|
||||
String area = "中国";
|
||||
String brief = doc.select(".img-text-con").text();
|
||||
String play_url = doc.select("#video source").attr("src");
|
||||
if (play_url.isEmpty()) play_url = doc.select("#video").attr("src");
|
||||
String vod_play_url = title + "$" + play_url;
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodPic(pic);
|
||||
vod.setVodName(title);
|
||||
vod.setVodActor(actor);
|
||||
vod.setVodArea(area);
|
||||
vod.setVodContent(brief);
|
||||
vod.setVodPlayFrom("Qile");
|
||||
vod.setVodPlayUrl(vod_play_url);
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String searchUrl = siteUrl + "/cse/search?q=" + URLEncoder.encode(key);
|
||||
Elements lis = Jsoup.parse(OkHttp.string(searchUrl, getHeader())).select(".search-video-li.list-br2");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : lis) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("h5.line-clamp1").text();
|
||||
String pic = li.select("dt.logo-bg img").attr("src");
|
||||
if (!pic.startsWith("https")) pic = "https:" + pic;
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).header(getHeader()).string();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Qile
|
||||
*/
|
||||
public class JavDb extends Spider {
|
||||
|
||||
private static String siteUrl = "https://javdb523.com";
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
if (!extend.isEmpty()) siteUrl = extend;
|
||||
}
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
header.put("Referer", siteUrl + "/");
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("", "censored", "uncensored", "western");
|
||||
List<String> typeNames = Arrays.asList("全部", "有码", "无码", "欧美");
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : doc.select(".item")) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").attr("title");
|
||||
String pic = li.select("img").attr("src");
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(classes, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String cateUrl = siteUrl + String.format("/%s?page=%s", tid, pg);
|
||||
Document doc = Jsoup.parse(OkHttp.string(cateUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : doc.select(".item")) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").attr("title");
|
||||
String pic = li.select("img").attr("src");
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
Document doc = Jsoup.parse(OkHttp.string(ids.get(0), getHeader()));
|
||||
if (doc.text().contains("歡迎登入")) return Result.error("该资源需要登入");
|
||||
List<String> vodItems = new ArrayList<>();
|
||||
Elements sourceList = doc.select(".item.columns");
|
||||
for (Element a : sourceList) {
|
||||
String episodeUrl = a.select("div a").attr("href");
|
||||
String episodeName = a.select("div a").text();
|
||||
vodItems.add(episodeName + "$" + episodeUrl);
|
||||
}
|
||||
Elements elements = doc.select(".panel-block");
|
||||
String classifyName = "";
|
||||
String year = "";
|
||||
String area = "";
|
||||
String remark = "";
|
||||
for (Element element : elements) {
|
||||
String text = element.text();
|
||||
if (text.startsWith("類別:")) {
|
||||
classifyName = element.select("span a").text();
|
||||
} else if (text.startsWith("片商:")) {
|
||||
area = element.select("span a").text();
|
||||
} else if (text.startsWith("日期:")) {
|
||||
year = element.select("span").text();
|
||||
} else if (text.startsWith("時長:")) {
|
||||
remark = element.select("span").text();
|
||||
}
|
||||
}
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodYear(year);
|
||||
vod.setVodArea(area);
|
||||
vod.setVodRemarks(remark);
|
||||
vod.setTypeName(classifyName);
|
||||
vod.setVodContent(ids.get(0));
|
||||
vod.setVodPlayFrom("Qile");
|
||||
vod.setVodPlayUrl(TextUtils.join("#", vodItems));
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String searchUrl = siteUrl + "/search?q=" + Uri.encode(key) + "&f=all";
|
||||
Document doc = Jsoup.parse(OkHttp.string(searchUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : doc.select(".item")) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").attr("title");
|
||||
String pic = li.select("img").attr("src");
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).header(getHeader()).string();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Qile
|
||||
*/
|
||||
public class JustLive extends Spider {
|
||||
|
||||
private String siteUrl = "http://live.yj1211.work";
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
if (!extend.isEmpty()) siteUrl = extend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("网游", "手游", "单机", "娱乐", "其他");
|
||||
List<String> typeNames = Arrays.asList("网游", "手游", "单机", "娱乐", "其他");
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
String f = "{\"网游\": [{\"key\": \"class\", \"name\": \"类型\", \"value\": [{\"n\": \"英雄联盟\", \"v\": \"英雄联盟\"}, {\"n\": \"无畏契约\", \"v\": \"无畏契约\"}, {\"n\": \"CS:GO\", \"v\": \"CS:GO\"}, {\"n\": \"APEX英雄\", \"v\": \"APEX英雄\"}, {\"n\": \"永劫无间\", \"v\": \"永劫无间\"}, {\"n\": \"穿越火线\", \"v\": \"穿越火线\"}, {\"n\": \"命运方舟\", \"v\": \"命运方舟\"}, {\"n\": \"DOTA2\", \"v\": \"DOTA2\"}, {\"n\": \"吃鸡行动\", \"v\": \"吃鸡行动\"}, {\"n\": \"逃离塔科夫\", \"v\": \"逃离塔科夫\"}, {\"n\": \"传奇\", \"v\": \"传奇\"}, {\"n\": \"DNF\", \"v\": \"DNF\"}, {\"n\": \"卡拉彼丘\", \"v\": \"卡拉彼丘\"}, {\"n\": \"幕后高手\", \"v\": \"幕后高手\"}, {\"n\": \"生死狙击2\", \"v\": \"生死狙击2\"}, {\"n\": \"洛奇英雄传\", \"v\": \"洛奇英雄传\"}, {\"n\": \"最终幻想14\", \"v\": \"最终幻想14\"}, {\"n\": \"重生边缘\", \"v\": \"重生边缘\"}, {\"n\": \"星际战甲\", \"v\": \"星际战甲\"}, {\"n\": \"梦三国\", \"v\": \"梦三国\"}, {\"n\": \"英魂之刃\", \"v\": \"英魂之刃\"}, {\"n\": \"剑网3\", \"v\": \"剑网3\"}]}], \"手游\": [{\"key\": \"class\", \"name\": \"类型\", \"value\": [{\"n\": \"王者荣耀\", \"v\": \"王者荣耀\"}, {\"n\": \"和平精英\", \"v\": \"和平精英\"}, {\"n\": \"原神\", \"v\": \"原神\"}, {\"n\": \"崩坏:星穹铁道\", \"v\": \"崩坏:星穹铁道\"}, {\"n\": \"第五人格\", \"v\": \"第五人格\"}, {\"n\": \"LOL手游\", \"v\": \"LOL手游\"}, {\"n\": \"明日方舟\", \"v\": \"明日方舟\"}, {\"n\": \"黎明觉醒:生机\", \"v\": \"黎明觉醒:生机\"}, {\"n\": \"蛋仔派对\", \"v\": \"蛋仔派对\"}, {\"n\": \"冒险岛手游\", \"v\": \"冒险岛手游\"}, {\"n\": \"闪耀!优俊少女\", \"v\": \"闪耀!优俊少女\"}, {\"n\": \"斯露德\", \"v\": \"斯露德\"}, {\"n\": \"千年之旅\", \"v\": \"千年之旅\"}, {\"n\": \"白夜极光\", \"v\": \"白夜极光\"}, {\"n\": \"逆水寒手游\", \"v\": \"逆水寒手游\"}, {\"n\": \"率土之滨\", \"v\": \"率土之滨\"}, {\"n\": \"月圆之夜\", \"v\": \"月圆之夜\"}]}],\"单机\": [{\"key\": \"class\", \"name\": \"类型\", \"value\": [{\"n\": \"主机游戏\", \"v\": \"主机游戏\"}, {\"n\": \"我的世界\", \"v\": \"我的世界\"}, {\"n\": \"独立游戏\", \"v\": \"独立游戏\"}, {\"n\": \"怀旧游戏\", \"v\": \"怀旧游戏\"}, {\"n\": \"猛兽派对\", \"v\": \"猛兽派对\"}, {\"n\": \"星空\", \"v\": \"星空\"}, {\"n\": \"塞尔达传说\", \"v\": \"塞尔达传说\"}, {\"n\": \"苍翼:混沌效应\", \"v\": \"苍翼:混沌效应\"}, {\"n\": \"命运2\", \"v\": \"命运2\"}, {\"n\": \"收获日3\", \"v\": \"收获日3\"}, {\"n\": \"机战佣兵VI 境界天火\", \"v\": \"机战佣兵VI 境界天火\"}, {\"n\": \"暗黑破坏神Ⅳ\", \"v\": \"暗黑破坏神Ⅳ\"}, {\"n\": \"匹诺曹的谎言\", \"v\": \"匹诺曹的谎言\"}, {\"n\": \"博德之门3\", \"v\": \"博德之门3\"}, {\"n\": \"绝世好武功\", \"v\": \"绝世好武功\"}, {\"n\": \"恐怖游戏\", \"v\": \"恐怖游戏\"}, {\"n\": \"Dark and Darker\", \"v\": \"Dark and Darker\"}, {\"n\": \"Warlander\", \"v\": \"Warlander\"}, {\"n\": \"FORZA 极限竞速\", \"v\": \"FORZA 极限竞速\"}, {\"n\": \"边境\", \"v\": \"边境\"}, {\"n\": \"生化危机\", \"v\": \"生化危机\"}]}], \"娱乐\": [{\"key\": \"class\", \"name\": \"类型\", \"value\": [{\"n\": \"聊天室\", \"v\": \"聊天室\"}, {\"n\": \"视频唱见\", \"v\": \"视频唱见\"}, {\"n\": \"萌宅领域\", \"v\": \"萌宅领域\"}, {\"n\": \"视频聊天\", \"v\": \"视频聊天\"}, {\"n\": \"舞见\", \"v\": \"舞见\"}, {\"n\": \"唱见电台\", \"v\": \"唱见电台\"}, {\"n\": \"聊天电台\", \"v\": \"聊天电台\"}, {\"n\": \"甜宠电台\", \"v\": \"甜宠电台\"}, {\"n\": \"TopStar\", \"v\": \"TopStar\"}, {\"n\": \"虚拟Singer\", \"v\": \"虚拟Singer\"}, {\"n\": \"虚拟Gamer\", \"v\": \"虚拟Gamer\"}, {\"n\": \"虚拟声优\", \"v\": \"虚拟声优\"}, {\"n\": \"虚拟日常\", \"v\": \"虚拟日常\"}, {\"n\": \"星秀\", \"v\": \"星秀\"}]}], \"其他\": [{\"key\": \"class\", \"name\": \"类型\", \"value\": [{\"n\": \"生活分享\", \"v\": \"生活分享\"}, {\"n\": \"户外\", \"v\": \"户外\"}, {\"n\": \"日常\", \"v\": \"日常\"}, {\"n\": \"情感\", \"v\": \"情感\"}, {\"n\": \"运动\", \"v\": \"运动\"}, {\"n\": \"搞笑\", \"v\": \"搞笑\"}, {\"n\": \"手工绘画\", \"v\": \"手工绘画\"}, {\"n\": \"萌宠\", \"v\": \"萌宠\"}, {\"n\": \"美食\", \"v\": \"美食\"}, {\"n\": \"时尚\", \"v\": \"时尚\"}, {\"n\": \"社科法律心理\", \"v\": \"社科法律心理\"}, {\"n\": \"人文历史\", \"v\": \"人文历史\"}, {\"n\": \"校园学习\", \"v\": \"校园学习\"}, {\"n\": \"职场·技能\", \"v\": \"职场·技能\"}, {\"n\": \"科技\", \"v\": \"科技\"}]}]}";
|
||||
JSONObject filterConfig = new JSONObject(f);
|
||||
String content = OkHttp.string(siteUrl + "/api/live/getRecommend?page=1&size=20", getHeader());
|
||||
List<Vod> list = new ArrayList<>();
|
||||
JSONArray dataArray = new JSONObject(content).getJSONArray("data");
|
||||
for (int i = 0; i < dataArray.length(); i++) {
|
||||
JSONObject jsonObject = dataArray.getJSONObject(i);
|
||||
String platform = jsonObject.getString("platForm");
|
||||
String roomId = jsonObject.getString("roomId");
|
||||
String categoryName = jsonObject.getString("categoryName");
|
||||
String roomName = jsonObject.getString("roomName");
|
||||
String name = categoryName + roomName;
|
||||
String pic = jsonObject.getString("roomPic");
|
||||
String remark = jsonObject.getString("ownerName");
|
||||
String vid = "platform=" + platform + "&roomId=" + roomId;
|
||||
list.add(new Vod(vid, name, pic, remark));
|
||||
}
|
||||
return Result.string(classes, list, filterConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
Map<String, String> ClassTypeMap = new HashMap<>();
|
||||
ClassTypeMap.put("网游", "英雄联盟");
|
||||
ClassTypeMap.put("手游", "王者荣耀");
|
||||
ClassTypeMap.put("单机", "主机游戏");
|
||||
ClassTypeMap.put("娱乐", "聊天室");
|
||||
ClassTypeMap.put("其他", "生活分享");
|
||||
String cateId = extend.get("cateId") == null ? tid : extend.get("cateId");
|
||||
String classType = extend.get("class") == null ? ClassTypeMap.get(cateId) : extend.get("class");
|
||||
String cateUrl = siteUrl + String.format("/api/live/getRecommendByAreaAll?areaType=%s&area=%s&page=%s", cateId, classType, pg);
|
||||
String content = OkHttp.string(cateUrl, getHeader());
|
||||
List<Vod> list = new ArrayList<>();
|
||||
JSONArray dataArray = new JSONObject(content).getJSONArray("data");
|
||||
for (int i = 0; i < dataArray.length(); i++) {
|
||||
JSONObject jsonObject = dataArray.getJSONObject(i);
|
||||
String platform = jsonObject.getString("platForm");
|
||||
String roomId = jsonObject.getString("roomId");
|
||||
String categoryName = jsonObject.getString("categoryName");
|
||||
String name = jsonObject.getString("roomName");
|
||||
String pic = jsonObject.getString("roomPic");
|
||||
String remark = jsonObject.getString("ownerName");
|
||||
remark = remark + "-" + categoryName;
|
||||
String vid = "platform=" + platform + "&roomId=" + roomId;
|
||||
list.add(new Vod(vid, name, pic, remark));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
String getRoomInfo = siteUrl + "/api/live/getRoomInfo?" + ids.get(0);
|
||||
String getRealUrl = siteUrl + "/api/live/getRealUrlMultiSource?" + ids.get(0);
|
||||
String content = OkHttp.string(getRealUrl, getHeader());
|
||||
String content1 = OkHttp.string(getRoomInfo, getHeader());
|
||||
JSONObject dataObject = new JSONObject(content).getJSONObject("data");
|
||||
List<String> lineNames = new ArrayList<>();
|
||||
List<String> vodItems = new ArrayList<>();
|
||||
Iterator<String> keys = dataObject.keys();
|
||||
while (keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
if (key.startsWith("线路")) lineNames.add(key);
|
||||
}
|
||||
Collections.sort(lineNames, (line1, line2) -> {
|
||||
int num1 = Integer.parseInt(line1.substring(2));
|
||||
int num2 = Integer.parseInt(line2.substring(2));
|
||||
return Integer.compare(num1, num2);
|
||||
});
|
||||
for (String lineName : lineNames) {
|
||||
JSONArray lineArray = dataObject.getJSONArray(lineName);
|
||||
List<String> episodeItems = new ArrayList<>();
|
||||
for (int i = 0; i < lineArray.length(); i++) {
|
||||
JSONObject item = lineArray.getJSONObject(i);
|
||||
String qualityName = item.getString("qualityName");
|
||||
String playUrl = item.getString("playUrl");
|
||||
episodeItems.add(qualityName + "$" + playUrl);
|
||||
}
|
||||
vodItems.add(TextUtils.join("#", episodeItems));
|
||||
}
|
||||
String vod_play_from = TextUtils.join("$$$", lineNames);
|
||||
String vod_play_urls = TextUtils.join("$$$", vodItems);
|
||||
JSONObject data = new JSONObject(content1).getJSONObject("data");
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodPic(data.getString("roomPic"));
|
||||
vod.setVodName(data.getString("roomName"));
|
||||
vod.setVodArea(data.getString("platForm").replace("douyu", "斗鱼").replace("huya", "虎牙").replace("bilibili", "哔哩哔哩").replace("douyin", "抖音").replace("cc", "网易CC"));
|
||||
vod.setVodActor(data.getString("ownerName"));
|
||||
vod.setVodRemarks("在线" + data.getInt("online") + "人");
|
||||
vod.setVodContent(getRealUrl);
|
||||
vod.setVodDirector("Qile");
|
||||
vod.setTypeName(data.getString("categoryName"));
|
||||
vod.setVodPlayFrom(vod_play_from);
|
||||
vod.setVodPlayUrl(vod_play_urls);
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String searchUrl = siteUrl + "/api/live/search?platform=all&keyWords=" + URLEncoder.encode(key) + "&uid=35717d71548f4ec9ab6f327cc16ad2bf";
|
||||
String content = OkHttp.string(searchUrl, getHeader());
|
||||
List<Vod> list = new ArrayList<>();
|
||||
JSONArray dataArray = new JSONObject(content).getJSONArray("data");
|
||||
for (int i = 0; i < dataArray.length(); i++) {
|
||||
JSONObject jsonObject = dataArray.getJSONObject(i);
|
||||
String platform = jsonObject.optString("platform");
|
||||
String roomId = jsonObject.optString("roomId");
|
||||
String name = jsonObject.optString("nickName");
|
||||
String pic = jsonObject.optString("headPic");
|
||||
String remark = jsonObject.optString("isLive");
|
||||
remark = remark.equals("1") ? "直播中" : "未开播";
|
||||
String vid = "platform=" + platform + "&roomId=" + roomId;
|
||||
list.add(new Vod(vid, name, pic, remark));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).header(getHeader()).string();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.Base64;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.ui.ScrollTextView;
|
||||
import com.github.catvod.utils.ResUtil;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
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 extend) {
|
||||
try {
|
||||
Notice notice = new Notice();
|
||||
notice.init(null, extend);
|
||||
notice.homeContent(false);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@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 = extend.startsWith("http") ? OkHttp.string(extend) : new String(Base64.decode(extend, Base64.DEFAULT));
|
||||
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, 500);
|
||||
return "";
|
||||
}
|
||||
|
||||
private void createView() {
|
||||
createText();
|
||||
createRoot();
|
||||
setColor();
|
||||
hide();
|
||||
}
|
||||
|
||||
private void createText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 2; i++) sb.append(SPACE).append(msg);
|
||||
view = new ScrollTextView(Init.context());
|
||||
view.setTextSize(20);
|
||||
view.setDuration(duration);
|
||||
view.setText(sb.toString());
|
||||
view.setTypeface(null, Typeface.BOLD);
|
||||
view.setPadding(0, ResUtil.dp2px(16), 0, ResUtil.dp2px(16));
|
||||
view.setBackgroundColor(Color.argb(200, 255, 255, 255));
|
||||
view.startScroll();
|
||||
}
|
||||
|
||||
private void createRoot() {
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.gravity = Gravity.TOP;
|
||||
Util.addView(view, params);
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
Init.run(() -> Util.removeView(view), duration * 1000);
|
||||
}
|
||||
|
||||
private void setColor() {
|
||||
Init.run(runnable, 500);
|
||||
}
|
||||
|
||||
private final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Random random = new Random();
|
||||
view.setTextColor(Color.argb(255, random.nextInt(128), random.nextInt(128), random.nextInt(128)));
|
||||
setColor();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhixc
|
||||
*/
|
||||
public class PanSearch extends Ali {
|
||||
|
||||
private final String URL = "https://www.pansearch.me/";
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
return header;
|
||||
}
|
||||
|
||||
private Map<String, String> getSearchHeader() {
|
||||
Map<String, String> header = getHeader();
|
||||
header.put("x-nextjs-data", "1");
|
||||
header.put("referer", URL);
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String html = OkHttp.string(URL, getHeader());
|
||||
String data = Jsoup.parse(html).select("script[id=__NEXT_DATA__]").get(0).data();
|
||||
String buildId = new JSONObject(data).getString("buildId");
|
||||
String url = URL + "_next/data/" + buildId + "/search.json?keyword=" + URLEncoder.encode(key) + "&pan=aliyundrive";
|
||||
String result = OkHttp.string(url, getSearchHeader());
|
||||
JSONArray array = new JSONObject(result).getJSONObject("pageProps").getJSONObject("data").getJSONArray("data");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
String content = item.optString("content");
|
||||
String[] split = content.split("\\n");
|
||||
if (split.length == 0) continue;
|
||||
String vodId = Jsoup.parse(content).select("a").attr("href");
|
||||
String name = split[0].replaceAll("</?[^>]+>", "");
|
||||
String remark = item.optString("time");
|
||||
String pic = item.optString("image");
|
||||
list.add(new Vod(vodId, name, pic, remark));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ColaMint & FongMi
|
||||
*/
|
||||
public class PanSou extends Ali {
|
||||
|
||||
private final String siteUrl = "https://www.alipansou.com";
|
||||
|
||||
private Map<String, String> getHeaders(String id) {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
headers.put("Referer", siteUrl + id);
|
||||
headers.put("_bid", "6d14a5dd6c07980d9dc089a693805ad8");
|
||||
return headers;
|
||||
}
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
HashMap<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
if (pattern.matcher(ids.get(0)).find()) return super.detailContent(ids);
|
||||
String url = siteUrl + ids.get(0).replace("/s/", "/cv/");
|
||||
url = OkHttp.getLocation(url, getHeaders(ids.get(0)));
|
||||
return super.detailContent(Arrays.asList(url));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
return searchContent(key, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick, String pg) throws Exception {
|
||||
return searchContent(key, pg);
|
||||
}
|
||||
|
||||
private String searchContent(String key, String pg) {
|
||||
String url = siteUrl + "/search?k=" + URLEncoder.encode(key) + "&page=" + pg + "&s=0&t=-1";
|
||||
Elements items = Jsoup.parse(OkHttp.string(url, getHeader())).select("van-row > a");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element item : items) {
|
||||
String title = item.selectFirst("template").text().trim();
|
||||
if (!title.contains(key)) continue;
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(item.attr("href"));
|
||||
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
||||
vod.setVodName(title);
|
||||
list.add(vod);
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,8 +15,6 @@ public class Proxy extends Spider {
|
|||
switch (params.get("do")) {
|
||||
case "ck":
|
||||
return new Object[]{200, "text/plain; charset=utf-8", new ByteArrayInputStream("ok".getBytes("UTF-8"))};
|
||||
case "ali":
|
||||
return Ali.proxy(params);
|
||||
case "bili":
|
||||
return Bili.proxy(params);
|
||||
case "webdav":
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
|
|
@ -19,20 +18,8 @@ import java.util.List;
|
|||
|
||||
public class Push extends Spider {
|
||||
|
||||
private final Ali ali;
|
||||
|
||||
public Push() {
|
||||
ali = new Ali();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
ali.init(context, extend);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
if (Ali.pattern.matcher(ids.get(0)).find()) return ali.detailContent(ids);
|
||||
return Result.string(vod(ids.get(0)));
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +30,7 @@ public class Push extends Spider {
|
|||
if (flag.equals("解析")) return Result.get().parse().jx().url(id).string();
|
||||
if (flag.equals("嗅探")) return Result.get().parse().url(id).string();
|
||||
if (flag.equals("迅雷")) return Result.get().url(id).string();
|
||||
return ali.playerContent(flag, id, vipFlags);
|
||||
return "";
|
||||
}
|
||||
|
||||
private Vod vod(String url) {
|
||||
|
|
|
|||
|
|
@ -1,153 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Filter;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.bean.star.Card;
|
||||
import com.github.catvod.bean.star.Condition;
|
||||
import com.github.catvod.bean.star.Group;
|
||||
import com.github.catvod.bean.star.Info;
|
||||
import com.github.catvod.bean.star.Person;
|
||||
import com.github.catvod.bean.star.Query;
|
||||
import com.github.catvod.bean.star.Video;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Star extends Spider {
|
||||
|
||||
private static final String apiUrl = "https://aws.ulivetv.net/v3/web/api/filter";
|
||||
private static final String siteUrl = "https://www.histar.tv/";
|
||||
private static final String detail = siteUrl + "vod/detail/";
|
||||
private static final String data = "_next/data/";
|
||||
private LinkedHashMap<String, String> map;
|
||||
private String ver;
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
headers.put("Referer", siteUrl);
|
||||
return headers;
|
||||
}
|
||||
|
||||
private String getVer() {
|
||||
for (Element script : Jsoup.parse(OkHttp.string(siteUrl, getHeader())).select("script")) if (script.attr("src").contains("buildManifest.js")) return script.attr("src").split("/")[3];
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
map = new LinkedHashMap<>();
|
||||
map.put("movie", "电影");
|
||||
map.put("drama", "电视剧");
|
||||
map.put("animation", "动漫");
|
||||
map.put("variety", "综艺");
|
||||
ver = getVer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) classes.add(new Class(entry.getKey(), entry.getValue()));
|
||||
for (Class type : classes) {
|
||||
Element script = Jsoup.parse(OkHttp.string(siteUrl + type.getTypeId() + "/all/all/all", getHeader())).select("#__NEXT_DATA__").get(0);
|
||||
JSONObject obj = new JSONObject(script.data()).getJSONObject("props").getJSONObject("pageProps").getJSONObject("filterCondition");
|
||||
Condition item = Condition.objectFrom(obj.toString());
|
||||
filters.put(type.getTypeId(), item.getFilter());
|
||||
}
|
||||
return Result.string(classes, filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeVideoContent() throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
Element script = Jsoup.parse(OkHttp.string(siteUrl, getHeader())).select("#__NEXT_DATA__").get(0);
|
||||
List<Card> cards = Card.arrayFrom(new JSONObject(script.data()).getJSONObject("props").getJSONObject("pageProps").getJSONArray("cards").toString());
|
||||
for (Card card : cards) if (!card.getName().equals("电视直播")) for (Card item : card.getCards()) list.add(item.vod());
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
if (tid.endsWith("/{pg}")) return searchContent(tid.split("/")[0], true);
|
||||
String year = extend.containsKey("year") ? extend.get("year") : "";
|
||||
String type = extend.containsKey("type") ? extend.get("type") : "";
|
||||
String area = extend.containsKey("area") ? extend.get("area") : "";
|
||||
Query query = new Query();
|
||||
query.setPageSize(16);
|
||||
query.setChName(map.get(tid));
|
||||
query.setPage(Integer.parseInt(pg));
|
||||
if (year.length() > 0) query.setYear(year);
|
||||
if (type.length() > 0) query.setLabel(type);
|
||||
if (area.length() > 0) query.setCountry(area);
|
||||
String body = OkHttp.post(apiUrl, query.toString());
|
||||
List<Card> cards = Card.arrayFrom(new JSONObject(body).getJSONObject("data").getJSONArray("list").toString());
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Card card : cards) list.add(card.vod());
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
Element script = Jsoup.parse(OkHttp.string(detail.concat(ids.get(0)), getHeader())).select("#__NEXT_DATA__").get(0);
|
||||
Info detail = Info.objectFrom(new JSONObject(script.data()).getJSONObject("props").getJSONObject("pageProps").getJSONObject("collectionInfo").toString());
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodYear(detail.getTime());
|
||||
vod.setVodName(detail.getName());
|
||||
vod.setVodPic(detail.getPicurl());
|
||||
vod.setVodArea(detail.getCountry());
|
||||
vod.setVodContent(detail.getDesc());
|
||||
vod.setVodRemarks(detail.getCountStr());
|
||||
vod.setVodActor(convert(detail.getActor()));
|
||||
vod.setVodDirector(convert(detail.getDirector()));
|
||||
List<String> playFrom = new ArrayList<>();
|
||||
List<String> playUrls = new ArrayList<>();
|
||||
for (Group group : detail.getVideosGroup()) {
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (Video video : group.getVideos()) urls.add(video.getEporder() + "$" + video.getPurl());
|
||||
playUrls.add(TextUtils.join("#", urls));
|
||||
playFrom.add(group.getName());
|
||||
}
|
||||
vod.setVodPlayUrl(TextUtils.join("$$$", playUrls));
|
||||
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom));
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
String json = OkHttp.string(siteUrl + data + ver + "/search.json?word=" + URLEncoder.encode(key), getHeader());
|
||||
List<Card> items = Card.arrayFrom(new JSONObject(json).getJSONObject("pageProps").getJSONArray("initList").toString());
|
||||
for (Card item : items) list.add(item.vod());
|
||||
return Result.get().vod(list).page().string();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).string();
|
||||
}
|
||||
|
||||
private String convert(List<Person> items) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Person item : items) sb.append(String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", item.getName() + "/{pg}", item.getName(), item.getName())).append(",");
|
||||
return Util.substring(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class UpYun extends Ali {
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
return searchContent(key, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick, String pg) throws Exception {
|
||||
return searchContent(key, pg);
|
||||
}
|
||||
|
||||
private String searchContent(String key, String pg) throws Exception {
|
||||
String searchUrl = "https://upapi.juapp9.com/search?keyword=" + URLEncoder.encode(key) + "&page=" + pg + "&s_type=2";
|
||||
String content = OkHttp.string(searchUrl, getHeader());
|
||||
String decodedContent = new String(Base64.decode(content, Base64.DEFAULT));
|
||||
JSONArray jsonArray = new JSONObject(decodedContent).getJSONObject("result").getJSONArray("items");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject jsonObj = jsonArray.getJSONObject(i);
|
||||
String id = jsonObj.optString("page_url");
|
||||
String name = jsonObj.optString("title");
|
||||
String pic = "https://pic.imgdb.cn/item/65767399c458853aeff8a6a0.webp";
|
||||
String remark = jsonObj.optString("insert_time");
|
||||
if (name.contains(key)) list.add(new Vod(id, name, pic, remark));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Json;
|
||||
import com.github.catvod.utils.Util;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author zhixc
|
||||
*/
|
||||
public class Wogg extends Ali {
|
||||
|
||||
private final String siteUrl = "https://www.wogg.net";
|
||||
private final Pattern regexCategory = Pattern.compile("/vodtype/(\\w+).html");
|
||||
private final Pattern regexPageTotal = Pattern.compile("\\$\\(\"\\.mac_total\"\\)\\.text\\('(\\d+)'\\);");
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
JsonObject ext = Json.safeObject(extend);
|
||||
super.init(context, ext.has("token") ? ext.get("token").getAsString() : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeader()));
|
||||
Elements elements = doc.select(".nav-link");
|
||||
for (Element e : elements) {
|
||||
Matcher mather = regexCategory.matcher(e.attr("href"));
|
||||
if (mather.find()) {
|
||||
classes.add(new Class(mather.group(1), e.text().trim()));
|
||||
}
|
||||
}
|
||||
return Result.string(classes, parseVodListFromDoc(doc));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||
String[] urlParams = new String[]{tid, "", "", "", "", "", "", "", pg, "", "", ""};
|
||||
if (extend != null && extend.size() > 0) {
|
||||
for (String key : extend.keySet()) {
|
||||
urlParams[Integer.parseInt(key)] = extend.get(key);
|
||||
}
|
||||
}
|
||||
Document doc = Jsoup.parse(OkHttp.string(String.format("%s/index.php/vodshow/%s.html", siteUrl, String.join("-", urlParams)), getHeader()));
|
||||
int page = Integer.parseInt(pg), limit = 72, total = 0;
|
||||
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(parseVodListFromDoc(doc)).page(page, count, limit, total).string();
|
||||
}
|
||||
|
||||
private List<Vod> parseVodListFromDoc(Document doc) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
Elements elements = doc.select(".module-item");
|
||||
for (Element e : elements) {
|
||||
String vodId = e.selectFirst(".video-name a").attr("href");
|
||||
String vodPic = e.selectFirst(".module-item-pic > img").attr("data-src");
|
||||
String vodName = e.selectFirst(".video-name").text();
|
||||
String vodRemarks = e.selectFirst(".module-item-text").text();
|
||||
list.add(new Vod(vodId, vodName, vodPic, vodRemarks));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
String vodId = ids.get(0);
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl + vodId, getHeader()));
|
||||
|
||||
Vod item = new Vod();
|
||||
item.setVodId(vodId);
|
||||
item.setVodName(doc.selectFirst(".video-info-header > .page-title").text());
|
||||
item.setVodPic(doc.selectFirst(".module-item-pic img").attr("data-src"));
|
||||
item.setVodArea(doc.select(".video-info-header a.tag-link").last().text());
|
||||
item.setTypeName(String.join(",", doc.select(".video-info-header div.tag-link a").eachText()));
|
||||
|
||||
List<String> shareLinks = doc.select(".module-row-text").eachAttr("data-clipboard-text");
|
||||
for (int i = 0; i < shareLinks.size(); i++) shareLinks.set(i, shareLinks.get(i).trim());
|
||||
|
||||
item.setVodPlayFrom(detailContentVodPlayFrom(shareLinks));
|
||||
item.setVodPlayUrl(detailContentVodPlayUrl(shareLinks));
|
||||
|
||||
Elements elements = doc.select(".video-info-item");
|
||||
for (Element e : elements) {
|
||||
String title = e.previousElementSibling().text();
|
||||
if (title.contains("导演")) {
|
||||
item.setVodDirector(String.join(",", e.select("a").eachText()));
|
||||
} else if (title.contains("主演")) {
|
||||
item.setVodActor(String.join(",", e.select("a").eachText()));
|
||||
} else if (title.contains("年代")) {
|
||||
item.setVodYear(e.selectFirst("a").text().trim());
|
||||
} else if (title.contains("备注")) {
|
||||
item.setVodRemarks(e.text().trim());
|
||||
} else if (title.contains("剧情")) {
|
||||
item.setVodContent(e.selectFirst(".sqjj_a").text().replace("[收起部分]", "").trim());
|
||||
}
|
||||
}
|
||||
|
||||
return Result.string(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
return searchContent(key, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick, String pg) throws Exception {
|
||||
return searchContent(key, pg);
|
||||
}
|
||||
|
||||
private String searchContent(String key, String pg) {
|
||||
String searchURL = siteUrl + String.format("/index.php/vodsearch/%s----------%s---.html", URLEncoder.encode(key), pg);
|
||||
String html = OkHttp.string(searchURL, getHeader());
|
||||
Elements items = Jsoup.parse(html).select(".module-search-item");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element item : items) {
|
||||
String vodId = item.select(".video-serial").attr("href");
|
||||
String name = item.select(".video-serial").attr("title");
|
||||
String pic = item.select(".module-item-pic > img").attr("data-src");
|
||||
String remark = item.select(".video-tag-icon").text();
|
||||
list.add(new Vod(vodId, name, pic, remark));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* XiaoZhiTiao
|
||||
*
|
||||
* @author Oiltea
|
||||
*/
|
||||
public class XiaoZhiTiao extends Ali {
|
||||
|
||||
private static final String siteUrl = "https://gitcafe.net/tool/alipaper/";
|
||||
private static final String aliUrl = "https://www.aliyundrive.com/s/";
|
||||
private String token;
|
||||
private Date date;
|
||||
|
||||
private Map<String, String> getHeaders() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("Host", "gitcafe.net");
|
||||
params.put("User-Agent", Util.CHROME);
|
||||
return params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
super.init(context, extend);
|
||||
date = new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("action", "search");
|
||||
params.put("from", "web");
|
||||
params.put("keyword", key);
|
||||
params.put("token", getToken());
|
||||
JSONObject object = new JSONObject(OkHttp.post(siteUrl, params, getHeaders()).getBody());
|
||||
if (!object.optBoolean("success")) return "";
|
||||
List<Vod> list = new ArrayList<>();
|
||||
JSONArray data = object.getJSONArray("data");
|
||||
for (int i = 0, len = data.length(); i < len; i++) {
|
||||
JSONObject o = data.getJSONObject(i);
|
||||
String alikey = o.getString("alikey");
|
||||
String title = o.getString("title");
|
||||
String creatime = o.getString("creatime");
|
||||
list.add(new Vod(aliUrl + alikey, title, "", TextUtils.isEmpty(creatime) ? "" : creatime.substring(0, 10)));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
private String getToken() throws JSONException {
|
||||
if (TextUtils.isEmpty(token) || new Date().compareTo(date) > 0) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("action", "get_token");
|
||||
params.put("from", "web");
|
||||
JSONObject object = new JSONObject(OkHttp.post(siteUrl, params, getHeaders()).getBody());
|
||||
if (object.getBoolean("success")) {
|
||||
token = object.getString("data");
|
||||
date = new Date(System.currentTimeMillis() + 24 * 60 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
public class YiSo extends Ali {
|
||||
|
||||
private HashMap<String, String> getHeaders() {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36");
|
||||
headers.put("Referer", "https://yiso.fun/");
|
||||
headers.put("Cookie", "satoken=2854cb58-3884-473b-84c4-34161f67a409");
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String json = OkHttp.string("https://yiso.fun/api/search?name=" + URLEncoder.encode(key) + "&pageNo=1&from=ali", getHeaders());
|
||||
JSONArray array = new JSONObject(json).getJSONObject("data").getJSONArray("list");
|
||||
ArrayList<Vod> list = new ArrayList<>();
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
Vod vod = new Vod();
|
||||
String name = array.getJSONObject(i).getJSONArray("fileInfos").getJSONObject(0).getString("fileName");
|
||||
String remark = array.getJSONObject(i).getString("gmtCreate");
|
||||
vod.setVodId(decrypt(array.getJSONObject(i).getString("url")));
|
||||
vod.setVodName(name);
|
||||
vod.setVodRemarks(remark);
|
||||
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
||||
list.add(vod);
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
public String decrypt(String str) {
|
||||
try {
|
||||
SecretKeySpec key = new SecretKeySpec("4OToScUFOaeVTrHE".getBytes("UTF-8"), "AES");
|
||||
IvParameterSpec iv = new IvParameterSpec("9CLGao1vHKqm17Oz".getBytes("UTF-8"));
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
cipher.init(Cipher.DECRYPT_MODE, key, iv);
|
||||
return new String(cipher.doFinal(Base64.decode(str.getBytes(), 0)), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Zhaozy extends Ali {
|
||||
|
||||
private final Pattern regexAli = Pattern.compile("(https://www.aliyundrive.com/s/[^\"]+)");
|
||||
private final Pattern regexVid = Pattern.compile("(\\S+)");
|
||||
private final String siteUrl = "https://zhaoziyuan1.cc/";
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
headers.put("Referer", siteUrl);
|
||||
return headers;
|
||||
}
|
||||
|
||||
private void getCookie() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("username", username);
|
||||
params.put("password", password);
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
headers.put("Referer", siteUrl + "stop.html");
|
||||
headers.put("Origin", siteUrl);
|
||||
OkHttp.post(siteUrl + "logiu.html", params, headers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
String[] split = extend.split("\\$\\$\\$");
|
||||
super.init(context, split[0]);
|
||||
username = split[1];
|
||||
password = split[2];
|
||||
getCookie();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
if (pattern.matcher(ids.get(0)).find()) return super.detailContent(ids);
|
||||
Matcher matcher = regexAli.matcher(OkHttp.string(siteUrl + ids.get(0), getHeader()));
|
||||
if (matcher.find()) return super.detailContent(Arrays.asList(matcher.group(1)));
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String url = siteUrl + "so?filename=" + URLEncoder.encode(key);
|
||||
Document doc = Jsoup.parse(OkHttp.string(url, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element element : doc.select("div.li_con div.news_text")) {
|
||||
String href = element.select("div.news_text a").attr("href");
|
||||
Matcher matcher = regexVid.matcher(href);
|
||||
if (!matcher.find()) continue;
|
||||
String name = element.select("div.news_text a h3").text();
|
||||
if (!name.contains(key)) continue;
|
||||
String remark = element.select("div.news_text a p").text().split("\\|")[1].split(":")[1];
|
||||
Vod vod = new Vod();
|
||||
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
||||
vod.setVodId(matcher.group(1));
|
||||
vod.setVodRemarks(remark);
|
||||
vod.setVodName(name);
|
||||
list.add(vod);
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'ru.cleverpumpkin.proguard-dictionaries-generator' version '1.0.8' apply false
|
||||
id 'com.android.application' version '8.5.0' apply false
|
||||
id 'com.android.library' version '8.5.0' apply false
|
||||
id 'com.android.application' version '8.7.2' apply false
|
||||
id 'com.android.library' version '8.7.2' apply false
|
||||
}
|
||||
|
||||
tasks.register('clean', Delete) {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
org.gradle.parallel=false
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
|
|
@ -19,4 +19,6 @@ android.enableJetifier=true
|
|||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.useFullClasspathForDexingTransform=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#Wed Mar 29 12:54:35 CST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
41c87635d7592069884a5dafa12acabe
|
||||
2c39c89021fcf622d49dc8126bb530d9
|
||||
|
|
|
|||
|
|
@ -6,14 +6,16 @@ rd /s/q "%~dp0\Smali_classes"
|
|||
java -jar "%~dp0\3rd\baksmali-2.5.2.jar" d "%~dp0\..\app\build\intermediates\dex\release\minifyReleaseWithR8\classes.dex" -o "%~dp0\Smali_classes"
|
||||
|
||||
rd /s/q "%~dp0\spider.jar\smali\com\github\catvod\spider"
|
||||
rd /s/q "%~dp0\spider.jar\smali\com\github\catvod\parser"
|
||||
rd /s/q "%~dp0\spider.jar\smali\com\github\catvod\js"
|
||||
rd /s/q "%~dp0\spider.jar\smali\com\google\gson"
|
||||
rd /s/q "%~dp0\spider.jar\smali\org\slf4j\"
|
||||
|
||||
if not exist "%~dp0\spider.jar\smali\com\github\catvod\" md "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||
if not exist "%~dp0\spider.jar\smali\com\google\gson\" md "%~dp0\spider.jar\smali\com\google\gson\"
|
||||
if not exist "%~dp0\spider.jar\smali\org\slf4j\" md "%~dp0\spider.jar\smali\org\slf4j\"
|
||||
|
||||
move "%~dp0\Smali_classes\com\github\catvod\spider" "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||
move "%~dp0\Smali_classes\com\github\catvod\parser" "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||
move "%~dp0\Smali_classes\com\github\catvod\js" "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||
move "%~dp0\Smali_classes\com\google\gson" "%~dp0\spider.jar\smali\com\google\gson\"
|
||||
move "%~dp0\Smali_classes\org\slf4j" "%~dp0\spider.jar\smali\org\slf4j\"
|
||||
|
||||
java -jar "%~dp0\3rd\apktool_2.4.1.jar" b "%~dp0\spider.jar" -c
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ java {
|
|||
|
||||
dependencies {
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||
implementation 'com.google.guava:guava:32.0.0-jre'
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.google.guava:guava:32.0.1-jre'
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#Mon Nov 18 21:36:17 CST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
Loading…
Reference in New Issue