夸克盘
This commit is contained in:
parent
7ab78e9967
commit
24f1af934a
|
|
@ -11,6 +11,7 @@ import com.github.catvod.net.OkResult;
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.utils.Json;
|
import com.github.catvod.utils.Json;
|
||||||
import com.github.catvod.utils.Path;
|
import com.github.catvod.utils.Path;
|
||||||
|
import com.github.catvod.utils.ProxyVideo;
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -39,6 +40,21 @@ public class QuarkApi {
|
||||||
private boolean isVip = false;
|
private boolean isVip = false;
|
||||||
private final Cache cache;
|
private final Cache cache;
|
||||||
|
|
||||||
|
private static class Loader {
|
||||||
|
static volatile QuarkApi INSTANCE = new QuarkApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static QuarkApi get() {
|
||||||
|
return QuarkApi.Loader.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void initQuark(String cookie) throws Exception {
|
||||||
|
this.ckey = Util.MD5(cookie);
|
||||||
|
this.cookie = cookie;
|
||||||
|
this.isVip = getVip();
|
||||||
|
}
|
||||||
|
|
||||||
private QuarkApi() {
|
private QuarkApi() {
|
||||||
Init.checkPermission();
|
Init.checkPermission();
|
||||||
|
|
||||||
|
|
@ -55,11 +71,26 @@ public class QuarkApi {
|
||||||
List<Item> subs = new ArrayList<>();
|
List<Item> subs = new ArrayList<>();
|
||||||
List<Map<String, Object>> listData = listFile(1, shareData, files, subs, shareData.getShareId(), shareData.getFolderId(), 1);
|
List<Map<String, Object>> listData = listFile(1, shareData, files, subs, shareData.getShareId(), shareData.getFolderId(), 1);
|
||||||
|
|
||||||
List<String> playFrom = Arrays.asList("轉存原畫", "分享原畫", "代理普畫");
|
List<String> playFrom = QuarkApi.get().getPlayFormatList();
|
||||||
List<String> episode = new ArrayList<>();
|
|
||||||
List<String> playUrl = new ArrayList<>();
|
List<String> playUrl = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < playFrom.size(); i++) playUrl.add(TextUtils.join("#", episode));
|
if (files.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < files.get(files.size() - 1).getShareIndex(); i++) {
|
||||||
|
for (int index = 0; index < playFrom.size(); index++) {
|
||||||
|
List<String> vodItems = new ArrayList<>();
|
||||||
|
for (Item video_item : files) {
|
||||||
|
if (video_item.getShareIndex() == i + 1) {
|
||||||
|
vodItems.add(video_item.getEpisodeUrl("电影"));// + findSubs(video_item.getName(), subs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
playUrl.add(TextUtils.join("#", vodItems));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Vod vod = new Vod();
|
Vod vod = new Vod();
|
||||||
vod.setVodId("");
|
vod.setVodId("");
|
||||||
vod.setVodContent("");
|
vod.setVodContent("");
|
||||||
|
|
@ -68,23 +99,24 @@ public class QuarkApi {
|
||||||
vod.setVodPlayUrl(TextUtils.join("$$$", playUrl));
|
vod.setVodPlayUrl(TextUtils.join("$$$", playUrl));
|
||||||
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom));
|
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom));
|
||||||
vod.setTypeName("夸克云盘");
|
vod.setTypeName("夸克云盘");
|
||||||
return null;
|
return vod;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Loader {
|
public String playerContent(String[] split, String flag) throws Exception {
|
||||||
static volatile QuarkApi INSTANCE = new QuarkApi();
|
|
||||||
|
String[] id_list = split;
|
||||||
|
String shareId = id_list[2], stoken = id_list[3], fileId = id_list[0], fileToken = id_list[1];
|
||||||
|
String playUrl = "";
|
||||||
|
if (flag.contains("原画")) {
|
||||||
|
playUrl = this.getDownload(shareId, stoken, fileId, fileToken, true);
|
||||||
|
} else {
|
||||||
|
playUrl = this.getLiveTranscoding(shareId, stoken, fileId, fileToken, flag);
|
||||||
|
}
|
||||||
|
Map<String, String> header = getHeaders();
|
||||||
|
header.remove("Host");
|
||||||
|
return ProxyVideo.buildCommonProxyUrl(playUrl, header);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QuarkApi get() {
|
|
||||||
return QuarkApi.Loader.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void initQuark(String cookie) throws Exception {
|
|
||||||
this.ckey = bytesToHex(MessageDigest.getInstance("MD5").digest(cookie.getBytes()));
|
|
||||||
this.cookie = cookie;
|
|
||||||
this.isVip = getVip();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, String> getHeaders() {
|
private Map<String, String> getHeaders() {
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
|
@ -96,15 +128,24 @@ public class QuarkApi {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String api(String url, Map<String, String> data, Integer retry, String method) throws Exception {
|
/**
|
||||||
|
* @param url
|
||||||
|
* @param params get 参数
|
||||||
|
* @param data post json
|
||||||
|
* @param retry
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private String api(String url, Map<String, String> params, Map<String, Object> data, Integer retry, String method) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
int leftRetry = retry != null ? retry : 3;
|
int leftRetry = retry != null ? retry : 3;
|
||||||
OkResult okResult;
|
OkResult okResult;
|
||||||
if ("GET".equals(method)) {
|
if ("GET".equals(method)) {
|
||||||
okResult = OkHttp.get(this.apiUrl + url, data, getHeaders());
|
okResult = OkHttp.get(this.apiUrl + url, params, getHeaders());
|
||||||
} else {
|
} else {
|
||||||
okResult = OkHttp.post(this.apiUrl + url, data, getHeaders());
|
okResult = OkHttp.post(this.apiUrl + url, Json.toJson(data), getHeaders());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -120,7 +161,7 @@ public class QuarkApi {
|
||||||
|
|
||||||
if (okResult.getCode() != 200 && leftRetry > 0) {
|
if (okResult.getCode() != 200 && leftRetry > 0) {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
return api(url, data, leftRetry - 1, method);
|
return api(url, params, data, leftRetry - 1, method);
|
||||||
}
|
}
|
||||||
return okResult.getBody();
|
return okResult.getBody();
|
||||||
}
|
}
|
||||||
|
|
@ -135,11 +176,11 @@ public class QuarkApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getVip() throws Exception {
|
private boolean getVip() throws Exception {
|
||||||
Map<String, Object> listData = Json.parseSafe(api("member?pr=ucpro&fr=pc&uc_param_str=&fetch_subscribe=true&_ch=home&fetch_identity=true", null, 0, "GET"), Map.class);
|
Map<String, Object> listData = Json.parseSafe(api("member?pr=ucpro&fr=pc&uc_param_str=&fetch_subscribe=true&_ch=home&fetch_identity=true", null, null, 0, "GET"), Map.class);
|
||||||
return "EXP_SVIP".equals(((Map<String, String>) listData.get("data")).get("member_type"));
|
return "EXP_SVIP".equals(((Map<String, String>) listData.get("data")).get("member_type"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getPlayFormatList() {
|
public List<String> getPlayFormatList() {
|
||||||
if (this.isVip) {
|
if (this.isVip) {
|
||||||
return Arrays.asList("4K", "超清", "高清", "普画");
|
return Arrays.asList("4K", "超清", "高清", "普画");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -158,7 +199,7 @@ public class QuarkApi {
|
||||||
private void getShareToken(ShareData shareData) throws Exception {
|
private void getShareToken(ShareData shareData) throws Exception {
|
||||||
if (!this.shareTokenCache.containsKey(shareData.getShareId())) {
|
if (!this.shareTokenCache.containsKey(shareData.getShareId())) {
|
||||||
this.shareTokenCache.remove(shareData.getShareId());
|
this.shareTokenCache.remove(shareData.getShareId());
|
||||||
Map<String, Object> shareToken = Json.parseSafe(api("share/sharepage/token?" + this.pr, Map.of("pwd_id", shareData.getShareId(), "passcode", shareData.getSharePwd()), 0, "POST"), Map.class);
|
Map<String, Object> shareToken = Json.parseSafe(api("share/sharepage/token?" + this.pr, Collections.emptyMap(), Map.of("pwd_id", shareData.getShareId(), "passcode", shareData.getSharePwd() == null ? "" : shareData.getSharePwd()), 0, "POST"), Map.class);
|
||||||
if (shareToken.containsKey("data") && ((Map<String, Object>) shareToken.get("data")).containsKey("stoken")) {
|
if (shareToken.containsKey("data") && ((Map<String, Object>) shareToken.get("data")).containsKey("stoken")) {
|
||||||
this.shareTokenCache.put(shareData.getShareId(), (Map<String, Object>) shareToken.get("data"));
|
this.shareTokenCache.put(shareData.getShareId(), (Map<String, Object>) shareToken.get("data"));
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +209,7 @@ public class QuarkApi {
|
||||||
private List<Map<String, Object>> listFile(int shareIndex, ShareData shareData, List<Item> videos, List<Item> subtitles, String shareId, String folderId, Integer page) throws Exception {
|
private List<Map<String, Object>> listFile(int shareIndex, ShareData shareData, List<Item> videos, List<Item> subtitles, String shareId, String folderId, Integer page) throws Exception {
|
||||||
int prePage = 200;
|
int prePage = 200;
|
||||||
page = page != null ? page : 1;
|
page = page != null ? page : 1;
|
||||||
Map<String, Object> listData = Json.parseSafe(api("share/sharepage/detail?" + this.pr + "&pwd_id=" + shareId + "&stoken=" + encodeURIComponent((String) this.shareTokenCache.get(shareId).get("stoken")) + "&pdir_fid=" + folderId + "&force=0&_page=" + page + "&_size=" + prePage + "&_sort=file_type:asc,file_name:asc", null, 0, "GET"), Map.class);
|
Map<String, Object> listData = Json.parseSafe(api("share/sharepage/detail?" + this.pr + "&pwd_id=" + shareId + "&stoken=" + encodeURIComponent((String) this.shareTokenCache.get(shareId).get("stoken")) + "&pdir_fid=" + folderId + "&force=0&_page=" + page + "&_size=" + prePage + "&_sort=file_type:asc,file_name:asc", Collections.emptyMap(), Collections.emptyMap(), 0, "GET"), Map.class);
|
||||||
if (listData.get("data") == null) return Collections.emptyList();
|
if (listData.get("data") == null) return Collections.emptyList();
|
||||||
List<Map<String, Object>> items = (List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list");
|
List<Map<String, Object>> items = (List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list");
|
||||||
if (items == null) return Collections.emptyList();
|
if (items == null) return Collections.emptyList();
|
||||||
|
|
@ -177,11 +218,11 @@ public class QuarkApi {
|
||||||
if (Boolean.TRUE.equals(item.get("dir"))) {
|
if (Boolean.TRUE.equals(item.get("dir"))) {
|
||||||
subDir.add(item);
|
subDir.add(item);
|
||||||
} else if (Boolean.TRUE.equals(item.get("file")) && "video".equals(item.get("obj_category"))) {
|
} else if (Boolean.TRUE.equals(item.get("file")) && "video".equals(item.get("obj_category"))) {
|
||||||
if ((int) item.get("size") < 1024 * 1024 * 5) continue;
|
if ((Double) item.get("size") < 1024 * 1024 * 5) continue;
|
||||||
item.put("stoken", this.shareTokenCache.get(shareData.getShareId()).get("stoken"));
|
item.put("stoken", this.shareTokenCache.get(shareData.getShareId()).get("stoken"));
|
||||||
videos.add(Item.objectFrom(Json.toJson(item), shareData.getShareId(), shareIndex));
|
videos.add(Item.objectFrom(item, shareData.getShareId(), shareIndex));
|
||||||
} else if ("file".equals(item.get("type")) && this.subtitleExts.contains("." + Util.getExt((String) item.get("file_name")))) {
|
} else if ("file".equals(item.get("type")) && this.subtitleExts.contains("." + Util.getExt((String) item.get("file_name")))) {
|
||||||
subtitles.add(Item.objectFrom(Json.toJson(item), shareData.getShareId(), shareIndex));
|
subtitles.add(Item.objectFrom(item, shareData.getShareId(), shareIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (page < Math.ceil((double) ((Map<String, Object>) listData.get("metadata")).get("_total") / prePage)) {
|
if (page < Math.ceil((double) ((Map<String, Object>) listData.get("metadata")).get("_total") / prePage)) {
|
||||||
|
|
@ -237,16 +278,13 @@ public class QuarkApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearSaveDir() throws Exception {
|
private void clearSaveDir() throws Exception {
|
||||||
Map<String, Object> listData = Json.parseSafe(api("file/sort?" + this.pr + "&pdir_fid=" + this.saveDirId + "&_page=1&_size=200&_sort=file_type:asc,updated_at:desc", Collections.emptyMap(), 0, "GET"), Map.class);
|
Map<String, Object> listData = Json.parseSafe(api("file/sort?" + this.pr + "&pdir_fid=" + this.saveDirId + "&_page=1&_size=200&_sort=file_type:asc,updated_at:desc", Collections.emptyMap(), Collections.emptyMap(), 0, "GET"), Map.class);
|
||||||
if (listData.get("data") != null && ((List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list")).size() > 0) {
|
if (listData.get("data") != null && ((List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list")).size() > 0) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
for (Map<String, Object> stringStringMap : ((List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list"))) {
|
for (Map<String, Object> stringStringMap : ((List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list"))) {
|
||||||
list.add((String) stringStringMap.get("fid"));
|
list.add((String) stringStringMap.get("fid"));
|
||||||
}
|
}
|
||||||
api("file/delete?" + this.pr,
|
api("file/delete?" + this.pr, Collections.emptyMap(), Map.of("action_type", "2", "filelist", Json.toJson(list), "exclude_fids", ""), 0, "POST");
|
||||||
|
|
||||||
|
|
||||||
Map.of("action_type", "2", "filelist", Json.toJson(list), "exclude_fids", ""), 0, "POST");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +293,7 @@ public class QuarkApi {
|
||||||
if (clean) clearSaveDir();
|
if (clean) clearSaveDir();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, Object> listData = Json.parseSafe(api("file/sort?" + this.pr + "&pdir_fid=0&_page=1&_size=200&_sort=file_type:asc,updated_at:desc", Collections.emptyMap(), 0, "GET"), Map.class);
|
Map<String, Object> listData = Json.parseSafe(api("file/sort?" + this.pr + "&pdir_fid=0&_page=1&_size=200&_sort=file_type:asc,updated_at:desc", Collections.emptyMap(), Collections.emptyMap(), 0, "GET"), Map.class);
|
||||||
if (listData.get("data") != null) {
|
if (listData.get("data") != null) {
|
||||||
for (Map<String, Object> item : (List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list")) {
|
for (Map<String, Object> item : (List<Map<String, Object>>) ((Map<String, Object>) listData.get("data")).get("list")) {
|
||||||
if (this.saveDirName.equals(item.get("file_name"))) {
|
if (this.saveDirName.equals(item.get("file_name"))) {
|
||||||
|
|
@ -266,7 +304,7 @@ public class QuarkApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.saveDirId == null) {
|
if (this.saveDirId == null) {
|
||||||
Map<String, Object> create = Json.parseSafe(api("file?" + this.pr, Map.of("pdir_fid", "0", "file_name", this.saveDirName, "dir_path", "", "dir_init_lock", "false"), 0, "POST"), Map.class);
|
Map<String, Object> create = Json.parseSafe(api("file?" + this.pr, Collections.emptyMap(), Map.of("pdir_fid", "0", "file_name", this.saveDirName, "dir_path", "", "dir_init_lock", "false"), 0, "POST"), Map.class);
|
||||||
if (create.get("data") != null && ((Map<String, Object>) create.get("data")).get("fid") != null) {
|
if (create.get("data") != null && ((Map<String, Object>) create.get("data")).get("fid") != null) {
|
||||||
this.saveDirId = ((Map<String, Object>) create.get("data")).get("fid").toString();
|
this.saveDirId = ((Map<String, Object>) create.get("data")).get("fid").toString();
|
||||||
}
|
}
|
||||||
|
|
@ -283,11 +321,11 @@ public class QuarkApi {
|
||||||
getShareToken(new ShareData(shareId, null));
|
getShareToken(new ShareData(shareId, null));
|
||||||
if (!this.shareTokenCache.containsKey(shareId)) return null;
|
if (!this.shareTokenCache.containsKey(shareId)) return null;
|
||||||
}
|
}
|
||||||
Map<String, Object> saveResult = Json.parseSafe(api("share/sharepage/save?" + this.pr, Map.of("fid_list", fileId, "fid_token_list", fileToken, "to_pdir_fid", this.saveDirId, "pwd_id", shareId, "stoken", stoken != null ? stoken : (String) this.shareTokenCache.get(shareId).get("stoken"), "pdir_fid", "0", "scene", "link"), 0, "POST"), Map.class);
|
Map<String, Object> saveResult = Json.parseSafe(api("share/sharepage/save?" + this.pr, null, Map.of("fid_list", List.of(fileId), "fid_token_list", List.of(fileToken), "to_pdir_fid", this.saveDirId, "pwd_id", shareId, "stoken", stoken != null ? stoken : (String) this.shareTokenCache.get(shareId).get("stoken"), "pdir_fid", "0", "scene", "link"), 0, "POST"), Map.class);
|
||||||
if (saveResult.get("data") != null && ((Map<String, Object>) saveResult.get("data")).get("task_id") != null) {
|
if (saveResult.get("data") != null && ((Map<String, Object>) saveResult.get("data")).get("task_id") != null) {
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
Map<String, Object> taskResult = Json.parseSafe(api("task?" + this.pr + "&task_id=" + ((Map<String, Object>) saveResult.get("data")).get("task_id") + "&retry_index=" + retry, Collections.emptyMap(), 0, "GET"), Map.class);
|
Map<String, Object> taskResult = Json.parseSafe(api("task?" + this.pr + "&task_id=" + ((Map<String, Object>) saveResult.get("data")).get("task_id") + "&retry_index=" + retry, Collections.emptyMap(), Collections.emptyMap(), 0, "GET"), Map.class);
|
||||||
if (taskResult.get("data") != null && ((Map<String, Object>) taskResult.get("data")).get("save_as") != null && ((Map<String, Object>) ((Map<String, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids") != null && ((List<String>) ((Map<String, Object>) ((Map<String, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids")).size() > 0) {
|
if (taskResult.get("data") != null && ((Map<String, Object>) taskResult.get("data")).get("save_as") != null && ((Map<String, Object>) ((Map<String, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids") != null && ((List<String>) ((Map<String, Object>) ((Map<String, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids")).size() > 0) {
|
||||||
return ((List<String>) ((Map<String, Object>) ((Map<String, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids")).get(0);
|
return ((List<String>) ((Map<String, Object>) ((Map<String, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids")).get(0);
|
||||||
}
|
}
|
||||||
|
|
@ -305,7 +343,7 @@ public class QuarkApi {
|
||||||
if (saveFileId == null) return null;
|
if (saveFileId == null) return null;
|
||||||
this.saveFileIdCaches.put(fileId, saveFileId);
|
this.saveFileIdCaches.put(fileId, saveFileId);
|
||||||
}
|
}
|
||||||
Map<String, Object> transcoding = Json.parseSafe(api("file/v2/play?" + this.pr, Map.of("fid", this.saveFileIdCaches.get(fileId), "resolutions", "normal,low,high,super,2k,4k", "supports", "fmp4"), 0, "POST"), Map.class);
|
Map<String, Object> transcoding = Json.parseSafe(api("file/v2/play?" + this.pr, Collections.emptyMap(), Map.of("fid", this.saveFileIdCaches.get(fileId), "resolutions", "normal,low,high,super,2k,4k", "supports", "fmp4"), 0, "POST"), Map.class);
|
||||||
if (transcoding.get("data") != null && ((Map<String, Object>) transcoding.get("data")).get("video_list") != null) {
|
if (transcoding.get("data") != null && ((Map<String, Object>) transcoding.get("data")).get("video_list") != null) {
|
||||||
String flagId = flag.split("-")[flag.split("-").length - 1];
|
String flagId = flag.split("-")[flag.split("-").length - 1];
|
||||||
int index = Util.findAllIndexes(getPlayFormatList(), flagId);
|
int index = Util.findAllIndexes(getPlayFormatList(), flagId);
|
||||||
|
|
@ -315,7 +353,7 @@ public class QuarkApi {
|
||||||
return video.get("video_info").toString();
|
return video.get("video_info").toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ((List<Map<String, Object>>) ((Map<String, Object>) transcoding.get("data")).get("video_list")).get(index).get("video_info").toString();
|
return (String) ((Map<String, Object>) ((List<Map<String, Object>>) ((Map<String, Object>) transcoding.get("data")).get("video_list")).get(index).get("video_info")).get("url");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +364,7 @@ public class QuarkApi {
|
||||||
if (saveFileId == null) return null;
|
if (saveFileId == null) return null;
|
||||||
this.saveFileIdCaches.put(fileId, saveFileId);
|
this.saveFileIdCaches.put(fileId, saveFileId);
|
||||||
}
|
}
|
||||||
Map<String, Object> down = Json.parseSafe(api("file/download?" + this.pr + "&uc_param_str=", Map.of("fids", this.saveFileIdCaches.get(fileId)), 0, "POST"), Map.class);
|
Map<String, Object> down = Json.parseSafe(api("file/download?" + this.pr + "&uc_param_str=", Collections.emptyMap(), Map.of("fids", this.saveFileIdCaches.get(fileId)), 0, "POST"), Map.class);
|
||||||
if (down.get("data") != null) {
|
if (down.get("data") != null) {
|
||||||
return ((List<String>) down.get("data")).get(0);
|
return ((List<String>) down.get("data")).get(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.github.catvod.bean.quark;
|
package com.github.catvod.bean.quark;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Item {
|
public class Item {
|
||||||
|
|
@ -11,11 +12,11 @@ public class Item {
|
||||||
private String name;
|
private String name;
|
||||||
private String type;
|
private String type;
|
||||||
private String formatType;
|
private String formatType;
|
||||||
private String size;
|
private Double size;
|
||||||
private String parent;
|
private String parent;
|
||||||
private String shareData;
|
private String shareData;
|
||||||
private int shareIndex;
|
private int shareIndex;
|
||||||
private long lastUpdateAt;
|
private Double lastUpdateAt;
|
||||||
private String subtitle;
|
private String subtitle;
|
||||||
|
|
||||||
public Item() {
|
public Item() {
|
||||||
|
|
@ -27,26 +28,26 @@ public class Item {
|
||||||
this.name = "";
|
this.name = "";
|
||||||
this.type = "";
|
this.type = "";
|
||||||
this.formatType = "";
|
this.formatType = "";
|
||||||
this.size = "";
|
this.size = 0d;
|
||||||
this.parent = "";
|
this.parent = "";
|
||||||
this.shareData = null;
|
this.shareData = null;
|
||||||
this.shareIndex = 0;
|
this.shareIndex = 0;
|
||||||
this.lastUpdateAt = 0;
|
this.lastUpdateAt = 0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item objectFrom(String item_json, String shareId, int shareIndex) {
|
public static Item objectFrom(Map<String, Object> item_json, String shareId, int shareIndex) {
|
||||||
Item item = new Item();
|
Item item = new Item();
|
||||||
item.fileId = item_json.contains("fid") ? item_json.split("fid=")[1].split("&")[0] : "";
|
item.fileId = item_json.get("fid") != null ? (String) item_json.get("fid") : "";
|
||||||
item.shareId = shareId;
|
item.shareId = shareId;
|
||||||
item.shareToken = item_json.contains("stoken") ? item_json.split("stoken=")[1].split("&")[0] : "";
|
item.shareToken = item_json.get("stoken") != null ? (String) item_json.get("stoken") : "";
|
||||||
item.shareFileToken = item_json.contains("share_fid_token") ? item_json.split("share_fid_token=")[1].split("&")[0] : "";
|
item.shareFileToken = item_json.get("share_fid_token") != null ? (String) item_json.get("share_fid_token") : "";
|
||||||
item.seriesId = item_json.contains("series_id") ? item_json.split("series_id=")[1].split("&")[0] : "";
|
item.seriesId = item_json.get("series_id") != null ? (String) item_json.get("series_id") : "";
|
||||||
item.name = item_json.contains("file_name") ? item_json.split("file_name=")[1].split("&")[0] : "";
|
item.name = item_json.get("file_name") != null ? (String) item_json.get("file_name") : "";
|
||||||
item.type = item_json.contains("obj_category") ? item_json.split("obj_category=")[1].split("&")[0] : "";
|
item.type = item_json.get("obj_category") != null ? (String) item_json.get("obj_category") : "";
|
||||||
item.formatType = item_json.contains("format_type") ? item_json.split("format_type=")[1].split("&")[0] : "";
|
item.formatType = item_json.get("format_type") != null ? (String) item_json.get("format_type") : "";
|
||||||
item.size = item_json.contains("size") ? item_json.split("size=")[1].split("&")[0] : "";
|
item.size = item_json.get("size") != null ? (Double) item_json.get("size") : 0d;
|
||||||
item.parent = item_json.contains("pdir_fid") ? item_json.split("pdir_fid=")[1].split("&")[0] : "";
|
item.parent = item_json.get("pdir_fid") != null ? (String) item_json.get("pdir_fid") : "";
|
||||||
item.lastUpdateAt = item_json.contains("last_update_at") ? Long.parseLong(item_json.split("last_update_at=")[1].split("&")[0]) : 0;
|
item.lastUpdateAt = item_json.get("last_update_at") != null ? (Double) item_json.get("last_update_at") : Double.valueOf(0d);
|
||||||
item.shareIndex = shareIndex;
|
item.shareIndex = shareIndex;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.utils.Json;
|
||||||
|
import com.github.catvod.utils.Util;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ColaMint & Adam & FongMi
|
||||||
|
*/
|
||||||
|
public class Cloud extends Spider {
|
||||||
|
private Quark quark = null;
|
||||||
|
private Ali ali = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Context context, String extend) throws Exception {
|
||||||
|
JsonObject ext = Json.safeObject(extend);
|
||||||
|
quark = new Quark();
|
||||||
|
ali = new Ali();
|
||||||
|
quark.init(context, ext.has("cookie") ? ext.get("cookie").getAsString() : "");
|
||||||
|
ali.init(context, ext.has("token") ? ext.get("token").getAsString() : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> shareUrl) throws Exception {
|
||||||
|
if (shareUrl.get(0).matches(Util.patternAli)) {
|
||||||
|
return ali.detailContent(shareUrl);
|
||||||
|
} else if (shareUrl.get(0).matches(Util.patternQuark)) {
|
||||||
|
return quark.detailContent(shareUrl);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected String detailContentVodPlayFrom(List<String> shareLinks) {
|
||||||
|
List<String> from = new ArrayList<>();
|
||||||
|
List<String> aliShare = new ArrayList<>();
|
||||||
|
List<String> quarkShare = new ArrayList<>();
|
||||||
|
for (String shareLink : shareLinks) {
|
||||||
|
if (shareLink.matches(Util.patternAli)) {
|
||||||
|
aliShare.add(shareLink);
|
||||||
|
} else if (shareLink.matches(Util.patternQuark)) {
|
||||||
|
quarkShare.add(shareLink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
from.add(quark.detailContentVodPlayFrom(quarkShare));
|
||||||
|
from.add(ali.detailContentVodPlayFrom(aliShare));
|
||||||
|
return TextUtils.join("$$$", from);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String detailContentVodPlayUrl(List<String> shareLinks) throws Exception {
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
for (String shareLink : shareLinks) {
|
||||||
|
if (shareLink.matches(Util.patternAli)) {
|
||||||
|
urls.add(ali.detailContentVodPlayUrl(List.of(shareLink)));
|
||||||
|
} else if (shareLink.matches(Util.patternQuark)) {
|
||||||
|
urls.add(quark.detailContentVodPlayUrl(List.of(shareLink)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TextUtils.join("$$$", urls);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,19 +2,14 @@ package com.github.catvod.spider;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.github.catvod.api.AliYun;
|
|
||||||
import com.github.catvod.api.QuarkApi;
|
import com.github.catvod.api.QuarkApi;
|
||||||
import com.github.catvod.bean.Result;
|
import com.github.catvod.bean.Result;
|
||||||
import com.github.catvod.bean.Vod;
|
|
||||||
import com.github.catvod.bean.quark.ShareData;
|
import com.github.catvod.bean.quark.ShareData;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,43 +19,22 @@ public class Quark extends Spider {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context, String extend) {
|
public void init(Context context, String extend) throws Exception {
|
||||||
|
|
||||||
//QuarkApi.get().setRefreshToken(extend);
|
QuarkApi.get().initQuark(extend);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
/* List<Item> videoItems = new ArrayList<>();
|
|
||||||
List<Item> subItems = new ArrayList<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
quarkApi.getFilesByShareUrl(1, ids.get(0), videoItems, subItems);
|
|
||||||
|
|
||||||
if (!videoItems.isEmpty()) {
|
|
||||||
SpiderDebug.log("获取播放链接成功,分享链接为:" + String.join("\t", ids));
|
|
||||||
} else {
|
|
||||||
SpiderDebug.log("获取播放链接失败,检查分享链接为:" + String.join("\t", ids));
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
SpiderDebug.log("获取夸克视频失败,失败原因为:" + e.getMessage() + " 行数为:" + e.getStackTrace()[0].getLineNumber());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
ShareData shareData = QuarkApi.get().getShareData(ids.get(0));
|
ShareData shareData = QuarkApi.get().getShareData(ids.get(0));
|
||||||
return Result.string(QuarkApi.get().getVod(shareData));
|
return Result.string(QuarkApi.get().getVod(shareData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
return AliYun.get().playerContent(id.split("\\+"), flag);
|
return Result.get().url(QuarkApi.get().playerContent(id.split("\\+\\+"), flag)).string();
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,12 +45,15 @@ public class Quark extends Spider {
|
||||||
*/
|
*/
|
||||||
public String detailContentVodPlayFrom(List<String> ids) {
|
public String detailContentVodPlayFrom(List<String> ids) {
|
||||||
List<String> playFrom = new ArrayList<>();
|
List<String> playFrom = new ArrayList<>();
|
||||||
if (ids.size() < 2)
|
/* if (ids.size() < 2){
|
||||||
return TextUtils.join("$$$", Arrays.asList("轉存原畫", "分享原畫", "代理普畫"));
|
return TextUtils.join("$$$", QuarkApi.get().getPlayFormatList());
|
||||||
|
}*/
|
||||||
for (int i = 1; i <= ids.size(); i++) {
|
for (int i = 1; i <= ids.size(); i++) {
|
||||||
playFrom.add(String.format(Locale.getDefault(), "轉存原畫#%02d", i));
|
for (String s : QuarkApi.get().getPlayFormatList()) {
|
||||||
playFrom.add(String.format(Locale.getDefault(), "分享原畫#%02d", i));
|
playFrom.add(String.format(Locale.getDefault(), "quark" + s + "#%02d", i));
|
||||||
playFrom.add(String.format(Locale.getDefault(), "代理普畫#%02d", i));
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return TextUtils.join("$$$", playFrom);
|
return TextUtils.join("$$$", playFrom);
|
||||||
}
|
}
|
||||||
|
|
@ -87,20 +64,13 @@ public class Quark extends Spider {
|
||||||
* @param ids share_link 集合
|
* @param ids share_link 集合
|
||||||
* @return 詳情內容視頻播放地址
|
* @return 詳情內容視頻播放地址
|
||||||
*/
|
*/
|
||||||
public String detailContentVodPlayUrl(List<String> ids) {
|
public String detailContentVodPlayUrl(List<String> ids) throws Exception {
|
||||||
/* List<String> playUrl = new ArrayList<>();
|
List<String> playUrl = new ArrayList<>();
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
Matcher matcher = pattern.matcher(id);
|
ShareData shareData = QuarkApi.get().getShareData(id);
|
||||||
if (matcher.find()) playUrl.add(parseVod(matcher, id).getVodPlayUrl());
|
playUrl.add(QuarkApi.get().getVod(shareData).getVodPlayUrl());
|
||||||
}
|
}
|
||||||
return TextUtils.join("$$$", playUrl);*/
|
return TextUtils.join("$$$", playUrl);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import java.util.regex.Pattern;
|
||||||
/**
|
/**
|
||||||
* @author zhixc
|
* @author zhixc
|
||||||
*/
|
*/
|
||||||
public class Wogg extends Ali {
|
public class Wogg extends Cloud {
|
||||||
|
|
||||||
private final String siteUrl = "https://www.wogg.net";
|
private final String siteUrl = "https://www.wogg.net";
|
||||||
private final Pattern regexCategory = Pattern.compile("/vodtype/(\\w+).html");
|
private final Pattern regexCategory = Pattern.compile("/vodtype/(\\w+).html");
|
||||||
|
|
@ -39,9 +39,9 @@ public class Wogg extends Ali {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context, String extend) {
|
public void init(Context context, String extend) throws Exception {
|
||||||
JsonObject ext = Json.safeObject(extend);
|
// JsonObject ext = Json.safeObject(extend);
|
||||||
super.init(context, ext.has("token") ? ext.get("token").getAsString() : "");
|
super.init(context, extend);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -100,10 +100,12 @@ public class Wogg extends Ali {
|
||||||
item.setTypeName(String.join(",", doc.select(".video-info-header div.tag-link a").eachText()));
|
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");
|
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());
|
for (int i = 0; i < shareLinks.size(); i++) {
|
||||||
|
shareLinks.set(i, shareLinks.get(i).trim());
|
||||||
item.setVodPlayFrom(detailContentVodPlayFrom(shareLinks));
|
//String detailContent = super.detailContent(List.of(shareLinks.get(i)));
|
||||||
item.setVodPlayUrl(detailContentVodPlayUrl(shareLinks));
|
}
|
||||||
|
item.setVodPlayFrom(super.detailContentVodPlayFrom(shareLinks));
|
||||||
|
item.setVodPlayUrl(super.detailContentVodPlayUrl(shareLinks));
|
||||||
|
|
||||||
Elements elements = doc.select(".video-info-item");
|
Elements elements = doc.select(".video-info-item");
|
||||||
for (Element e : elements) {
|
for (Element e : elements) {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
public static final String patternAli = "(https:\\/\\/www\\.aliyundrive\\.com\\/s\\/[^\"]+|https:\\/\\/www\\.alipan\\.com\\/s\\/[^\"]+)";
|
||||||
|
public static final String patternQuark = "(https:\\/\\/pan\\.quark\\.cn\\/s\\/[^\"]+)";
|
||||||
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)|http((?!http).)*?video/tos*");
|
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)|http((?!http).)*?video/tos*");
|
||||||
public static final Pattern THUNDER = Pattern.compile("(magnet|thunder|ed2k):.*");
|
public static final Pattern THUNDER = Pattern.compile("(magnet|thunder|ed2k):.*");
|
||||||
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36";
|
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36";
|
||||||
|
|
@ -285,6 +286,7 @@ public class Util {
|
||||||
public static String base64Decode(String s) {
|
public static String base64Decode(String s) {
|
||||||
return new String(android.util.Base64.decode(s, Base64.DEFAULT), Charset.defaultCharset());
|
return new String(android.util.Base64.decode(s, Base64.DEFAULT), Charset.defaultCharset());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String base64Encode(byte[] bytes) {
|
public static String base64Encode(byte[] bytes) {
|
||||||
return new String(android.util.Base64.encode(bytes, Base64.DEFAULT), Charset.defaultCharset());
|
return new String(android.util.Base64.encode(bytes, Base64.DEFAULT), Charset.defaultCharset());
|
||||||
}
|
}
|
||||||
|
|
@ -349,8 +351,6 @@ public class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String sha1Hex(String input) throws NoSuchAlgorithmException {
|
public static String sha1Hex(String input) throws NoSuchAlgorithmException {
|
||||||
try {
|
try {
|
||||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
import android.app.Application;
|
||||||
|
import com.github.catvod.spider.Init;
|
||||||
|
import com.github.catvod.spider.Quark;
|
||||||
|
import com.github.catvod.spider.Wogg;
|
||||||
|
import com.github.catvod.utils.Json;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class QuarkTest {
|
||||||
|
|
||||||
|
private Application mockContext;
|
||||||
|
|
||||||
|
private Quark spider;
|
||||||
|
|
||||||
|
@org.junit.Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
mockContext = RuntimeEnvironment.application;
|
||||||
|
Init.init(mockContext);
|
||||||
|
spider = new Quark();
|
||||||
|
spider.init(mockContext, "b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.Test
|
||||||
|
public void init() throws Exception {
|
||||||
|
spider.init(mockContext, "b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT");
|
||||||
|
//Assert.assertFalse(map.getAsJsonArray("list").isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.Test
|
||||||
|
public void detailContent() throws Exception {
|
||||||
|
|
||||||
|
String content = spider.detailContent(Arrays.asList("https://pan.quark.cn/s/38c5e16d71f7"));
|
||||||
|
JsonObject map = Json.safeObject(content);
|
||||||
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
System.out.println("detailContent--" + gson.toJson(map));
|
||||||
|
Assert.assertFalse(map.getAsJsonArray("list").isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.Test
|
||||||
|
public void playerContent() throws Exception {
|
||||||
|
|
||||||
|
String content = spider.playerContent("4K","c3f6b5fa48234c53909c65a4ff0f1888++de2277b662f92024bc08531d40ba91da++38c5e16d71f7++s79mbHXUZ61kQSYREE5Y3rdTvey/pLM73lNNGsv8VBk=",new ArrayList<>());
|
||||||
|
JsonObject map = Json.safeObject(content);
|
||||||
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
System.out.println("playerContent--" + gson.toJson(map));
|
||||||
|
Assert.assertFalse(map.getAsJsonPrimitive("url").getAsString().isEmpty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ public class WoggTest {
|
||||||
mockContext = RuntimeEnvironment.application;
|
mockContext = RuntimeEnvironment.application;
|
||||||
Init.init(mockContext);
|
Init.init(mockContext);
|
||||||
spider = new Wogg();
|
spider = new Wogg();
|
||||||
spider.init(mockContext, "");
|
spider.init(mockContext, "{\"cookie\":\"b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT\",\"token\":\"26fc6787afff43e78b78992e782502f1\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
|
|
@ -52,12 +52,12 @@ public class WoggTest {
|
||||||
|
|
||||||
System.out.println("homeVideoContent--" + gson.toJson(map));
|
System.out.println("homeVideoContent--" + gson.toJson(map));
|
||||||
|
|
||||||
// Assert.assertFalse(map.getAsJsonArray("list").isEmpty());
|
// Assert.assertFalse(map.getAsJsonArray("list").isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
public void categoryContent() throws Exception {
|
public void categoryContent() throws Exception {
|
||||||
String content = spider.categoryContent("1", "2", true, null);
|
String content = spider.categoryContent("2", "2", true, null);
|
||||||
JsonObject map = Json.safeObject(content);
|
JsonObject map = Json.safeObject(content);
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
System.out.println("categoryContent--" + gson.toJson(map));
|
System.out.println("categoryContent--" + gson.toJson(map));
|
||||||
|
|
@ -67,7 +67,7 @@ public class WoggTest {
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
public void detailContent() throws Exception {
|
public void detailContent() throws Exception {
|
||||||
|
|
||||||
String content = spider.detailContent(Arrays.asList("/voddetail/85517.html"));
|
String content = spider.detailContent(Arrays.asList("/voddetail/85997.html"));
|
||||||
JsonObject map = Json.safeObject(content);
|
JsonObject map = Json.safeObject(content);
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
System.out.println("detailContent--" + gson.toJson(map));
|
System.out.println("detailContent--" + gson.toJson(map));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue