夸克盘扫码
This commit is contained in:
parent
9211db7941
commit
308fe8ac66
|
|
@ -20,11 +20,9 @@ import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.net.OkResult;
|
import com.github.catvod.net.OkResult;
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.utils.*;
|
import com.github.catvod.utils.*;
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
@ -300,9 +298,8 @@ public class QuarkApi {
|
||||||
private List<Item> listFile(int shareIndex, ShareData shareData, List<Item> videos, List<Item> subtitles, String shareId, String folderId, Integer page) throws Exception {
|
private List<Item> 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;
|
||||||
Type type = new TypeToken<ApiResponse<Data>>() {
|
|
||||||
}.getType();
|
ApiResponse 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"), ApiResponse.class);
|
||||||
ApiResponse<Data> 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"), type);
|
|
||||||
if (listData.getData() == null) return Collections.emptyList();
|
if (listData.getData() == null) return Collections.emptyList();
|
||||||
List<Item> items = listData.getData().getList();
|
List<Item> items = listData.getData().getList();
|
||||||
if (items == null) return Collections.emptyList();
|
if (items == null) return Collections.emptyList();
|
||||||
|
|
@ -371,9 +368,8 @@ public class QuarkApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearSaveDir() throws Exception {
|
private void clearSaveDir() throws Exception {
|
||||||
Type type = new TypeToken<ApiResponse<Data>>() {
|
|
||||||
}.getType();
|
ApiResponse 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"), ApiResponse.class);
|
||||||
ApiResponse<Data> 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"), type);
|
|
||||||
if (listData.getData() != null && !listData.getData().getList().isEmpty()) {
|
if (listData.getData() != null && !listData.getData().getList().isEmpty()) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
for (Item stringStringMap : listData.getData().getList()) {
|
for (Item stringStringMap : listData.getData().getList()) {
|
||||||
|
|
@ -388,9 +384,8 @@ public class QuarkApi {
|
||||||
if (clean) clearSaveDir();
|
if (clean) clearSaveDir();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Type type = new TypeToken<ApiResponse<Data>>() {
|
|
||||||
}.getType();
|
ApiResponse 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"), ApiResponse.class);
|
||||||
ApiResponse<Data> 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"), type);
|
|
||||||
if (listData.getData() != null) {
|
if (listData.getData() != null) {
|
||||||
for (Item item : listData.getData().getList()) {
|
for (Item item : listData.getData().getList()) {
|
||||||
if (this.saveDirName.equals(item.getFileName())) {
|
if (this.saveDirName.equals(item.getFileName())) {
|
||||||
|
|
@ -418,17 +413,15 @@ 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;
|
||||||
}
|
}
|
||||||
Type type = new TypeToken<ApiResponse<HashMap<String, String>>>() {
|
|
||||||
}.getType();
|
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);
|
||||||
ApiResponse<HashMap<String, String>> 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"), type);
|
if (saveResult.get("data") != null && ((Map<Object, Object>) saveResult.get("data")).get("task_id") != null) {
|
||||||
if (saveResult.getData() != null && (saveResult.getData()).get("task_id") != null) {
|
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
Type type2 = new TypeToken<ApiResponse<HashMap<String, Object>>>() {
|
|
||||||
}.getType();
|
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);
|
||||||
ApiResponse<HashMap<String, Object>> taskResult = Json.parseSafe(api("task?" + this.pr + "&task_id=" + (saveResult.getData()).get("task_id") + "&retry_index=" + retry, Collections.emptyMap(), Collections.emptyMap(), 0, "GET"), type2);
|
if (taskResult.get("data") != null && ((Map<Object, Object>) taskResult.get("data")).get("save_as") != null && ((Map<Object, Object>) ((Map<Object, 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.getData() != null && taskResult.getData().get("save_as") != null && ((Map<String, Object>) taskResult.getData().get("save_as")).get("save_as_top_fids") != null && ((List<String>) ((Map<String, Object>) ((Map<String, Object>) taskResult.getData()).get("save_as")).get("save_as_top_fids")).size() > 0) {
|
return ((List<String>) ((Map<String, Object>) ((Map<Object, Object>) taskResult.get("data")).get("save_as")).get("save_as_top_fids")).get(0);
|
||||||
return ((List<String>) ((Map<String, Object>) (taskResult.getData()).get("save_as")).get("save_as_top_fids")).get(0);
|
|
||||||
}
|
}
|
||||||
retry++;
|
retry++;
|
||||||
if (retry > 2) break;
|
if (retry > 2) break;
|
||||||
|
|
@ -444,19 +437,18 @@ public class QuarkApi {
|
||||||
if (saveFileId == null) return null;
|
if (saveFileId == null) return null;
|
||||||
this.saveFileIdCaches.put(fileId, saveFileId);
|
this.saveFileIdCaches.put(fileId, saveFileId);
|
||||||
}
|
}
|
||||||
Type type2 = new TypeToken<ApiResponse<HashMap<String, Object>>>() {
|
|
||||||
}.getType();
|
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);
|
||||||
ApiResponse<HashMap<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"), type2);
|
if (transcoding.get("data") != null && ((Map<Object, Object>) transcoding.get("data")).get("video_list") != null) {
|
||||||
if (transcoding.getData() != null && (transcoding.getData()).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);
|
||||||
String quarkFormat = getPlayFormatQuarkList().get(index);
|
String quarkFormat = getPlayFormatQuarkList().get(index);
|
||||||
for (Map<String, Object> video : (List<Map<String, Object>>) (transcoding.getData()).get("video_list")) {
|
for (Map<String, Object> video : (List<Map<String, Object>>) ((Map<Object, Object>) transcoding.get("data")).get("video_list")) {
|
||||||
if (video.get("resolution").equals(quarkFormat)) {
|
if (video.get("resolution").equals(quarkFormat)) {
|
||||||
return (String) ((Map<String, Object>) video.get("video_info")).get("url");
|
return (String) ((Map<String, Object>) video.get("video_info")).get("url");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (String) ((Map<String, Object>) ((List<Map<String, Object>>) (transcoding.getData()).get("video_list")).get(index).get("video_info")).get("url");
|
return (String) ((Map<String, Object>) ((List<Map<String, Object>>) ((Map<Object, Object>) transcoding.get("data")).get("video_list")).get(index).get("video_info")).get("url");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public class ApiResponse<T> {
|
||||||
@SerializedName("timestamp")
|
@SerializedName("timestamp")
|
||||||
private long timestamp;
|
private long timestamp;
|
||||||
@SerializedName("data")
|
@SerializedName("data")
|
||||||
private T data;
|
private Data data;
|
||||||
@SerializedName("metadata")
|
@SerializedName("metadata")
|
||||||
private Metadata metadata;
|
private Metadata metadata;
|
||||||
public ApiResponse() {
|
public ApiResponse() {
|
||||||
|
|
@ -51,11 +51,11 @@ public class ApiResponse<T> {
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getData() {
|
public Data getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(T data) {
|
public void setData(Data data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
827a5607ec16fc5d5b9fee4c3c2d2a11
|
28aa6e38d4ab4f6cafec8b7c3c33b454
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;827a5607ec16fc5d5b9fee4c3c2d2a11",
|
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;28aa6e38d4ab4f6cafec8b7c3c33b454",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;827a5607ec16fc5d5b9fee4c3c2d2a11",
|
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;28aa6e38d4ab4f6cafec8b7c3c33b454",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;827a5607ec16fc5d5b9fee4c3c2d2a11",
|
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;28aa6e38d4ab4f6cafec8b7c3c33b454",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue