This commit is contained in:
GH Action - Upstream Sync 2023-12-02 01:10:02 +00:00
commit 3764054bd3
7 changed files with 29 additions and 26 deletions

View File

@ -243,7 +243,7 @@ public class AliYun {
List<Item> subs = new ArrayList<>();
listFiles(shareId, new Item(getParentFileId(fileId, share)), files, subs);
Collections.sort(files);
List<String> playFrom = Arrays.asList("原畫", "普畫");
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));
@ -328,7 +328,7 @@ public class AliYun {
public String getShareDownloadUrl(String shareId, String fileId) {
try {
if (shareDownloadMap.containsKey(fileId) && shareDownloadMap.get(fileId) != null && !isExpire(shareDownloadMap.get(fileId))) return shareDownloadMap.get(fileId);
if (shareDownloadMap.containsKey(fileId) && shareDownloadMap.get(fileId) != null && !isExpire(shareDownloadMap.get(fileId), 600)) return shareDownloadMap.get(fileId);
refreshShareToken(shareId);
SpiderDebug.log("getShareDownloadUrl..." + fileId);
JsonObject param = new JsonObject();
@ -347,13 +347,14 @@ public class AliYun {
public String getDownloadUrl(String shareId, String fileId) {
try {
if (downloadMap.containsKey(fileId) && downloadMap.get(fileId) != null && !isExpire(downloadMap.get(fileId))) return downloadMap.get(fileId);
if (downloadMap.containsKey(fileId) && downloadMap.get(fileId) != null && !isExpire(downloadMap.get(fileId), 900)) 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);
@ -375,7 +376,7 @@ public class AliYun {
param.addProperty("file_id", tempIds.get(0));
param.addProperty("drive_id", cache.getDrive().getDriveId());
param.addProperty("category", "live_transcoding");
param.addProperty("url_expire_sec", "14400");
param.addProperty("url_expire_sec", 900);
String json = oauth("openFile/getVideoPreviewPlayInfo", param.toString(), true);
return Preview.objectFrom(json).getVideoPreviewPlayInfo();
} catch (Exception e) {
@ -387,9 +388,9 @@ public class AliYun {
}
public String playerContent(String[] ids, String flag) {
if (flag.split("#")[0].equals("普畫")) {
if (flag.split("#")[0].equals("代理普畫")) {
return getPreviewContent(ids);
} else if (flag.split("#")[0].equals("原畫")) {
} 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();
@ -400,24 +401,18 @@ public class AliYun {
private String getPreviewContent(String[] ids) {
Preview.Info info = getVideoPreviewPlayInfo(ids[0], ids[1]);
List<String> url = getPreviewUrl(info);
List<String> proxyUrl = new ArrayList<>();
for (int i = 0; i < url.size(); i++) {
String item = url.get(i);
if (item.startsWith("http")) item = proxyVideoUrl("preview", ids[0], ids[1], url.get(i - 1));
proxyUrl.add(item);
}
List<String> url = getPreviewUrl(info, ids[0], ids[1], true);
List<Sub> subs = getSubs(ids);
subs.addAll(getSubs(info));
return Result.get().url(proxyUrl).m3u8().subs(subs).header(getHeader()).string();
return Result.get().url(url).m3u8().subs(subs).header(getHeader()).string();
}
private List<String> getPreviewUrl(Preview.Info info) {
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(tasks.get(i).getUrl());
url.add(proxy ? proxyVideoUrl("preview", shareId, fileId, tasks.get(i).getTemplateId()) : tasks.get(i).getUrl());
}
return url;
}
@ -465,10 +460,10 @@ public class AliYun {
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) {
private static boolean isExpire(String url, int time) {
String expires = new UrlQuerySanitizer(url).getValue("x-oss-expires");
if (TextUtils.isEmpty(expires)) return false;
return Long.parseLong(expires) - getTimeStamp() <= 60;
return Long.parseLong(expires) - getTimeStamp() <= time / 60;
}
private static long getTimeStamp() {
@ -497,7 +492,7 @@ public class AliYun {
} else if ("m3u8".equals(cate)) {
lock.lock();
String mediaUrl = m3u8MediaMap.get(fileId).get(mediaId);
if (isExpire(mediaUrl)) {
if (isExpire(mediaUrl, 900)) {
getM3u8(shareId, fileId, templateId);
mediaUrl = m3u8MediaMap.get(fileId).get(mediaId);
}
@ -531,7 +526,7 @@ public class AliYun {
private String getM3u8Url(String shareId, String fileId, String templateId) {
Preview.Info info = getVideoPreviewPlayInfo(shareId, fileId);
List<String> url = getPreviewUrl(info);
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));

View File

@ -54,10 +54,11 @@ public class Ali extends Spider {
*/
public String detailContentVodPlayFrom(List<String> ids) {
List<String> playFrom = new ArrayList<>();
if (ids.size() < 2) return TextUtils.join("$$$", Arrays.asList("原畫", "普畫"));
if (ids.size() < 2) return TextUtils.join("$$$", Arrays.asList("轉存原畫", "分享原畫", "代理普畫"));
for (int i = 1; i <= ids.size(); i++) {
playFrom.add(String.format(Locale.getDefault(), "原畫#%02d", i));
playFrom.add(String.format(Locale.getDefault(), "普畫#%02d", i));
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);
}

View File

@ -1,5 +1,8 @@
package com.github.catvod.utils;
import com.github.catvod.spider.Proxy;
import java.net.URLEncoder;
import java.util.Map;
import java.util.TreeMap;
@ -7,6 +10,10 @@ import fi.iki.elonen.NanoHTTPD;
public class MultiThread {
public static String url(String url, int thread) {
return String.format(Proxy.getUrl() + "?do=multi&url=%s&thread=%d", URLEncoder.encode(url), thread);
}
public static Object[] proxy(Map<String, String> params) throws Exception {
String url = params.get("url");
int thread = Integer.parseInt(params.get("thread"));

Binary file not shown.

View File

@ -1 +1 @@
d21813e2dfdd1685610b2748e96e6c3a
e19f98c566e2280e961ce054f9367808

View File

@ -1,5 +1,5 @@
{
"spider": "https://fm.t4tv.hz.cz/jar/custom_spider.jar;md5;d21813e2dfdd1685610b2748e96e6c3a",
"spider": "https://fm.t4tv.hz.cz/jar/custom_spider.jar;md5;e19f98c566e2280e961ce054f9367808",
"wallpaper": "https://gao.chuqiuyu.tk",
"sites": [
{

View File

@ -1,5 +1,5 @@
{
"spider": "https://fm.t4tv.hz.cz/jar/custom_spider.jar;md5;d21813e2dfdd1685610b2748e96e6c3a",
"spider": "https://fm.t4tv.hz.cz/jar/custom_spider.jar;md5;e19f98c566e2280e961ce054f9367808",
"wallpaper": "http://饭太硬.top/深色壁纸/api.php",
"sites": [
{