mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-15 11:53:02 +00:00
客户端链接(实验性),js解析器插件,汽水音乐,一刻相册,咪咕音乐
This commit is contained in:
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
*/
|
||||
public class FjTool extends PanBase {
|
||||
public static final String REFERER_URL = "https://share.feijipan.com/";
|
||||
private static final String API_URL_PREFIX = "https://api.feijipan.com/ws/";
|
||||
private static final String API_URL_PREFIX = "https://api.feejii.com/ws/";
|
||||
|
||||
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "recommend/list?devType=6&devModel=Chrome" +
|
||||
"&uuid={uuid}&extra=2×tamp={ts}&shareId={shareId}&type=0&offset=1&limit=60";
|
||||
@@ -83,6 +83,7 @@ public class FjTool extends PanBase {
|
||||
super(shareLinkInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<String> parse() {
|
||||
|
||||
// 240530 此处shareId又改为了原始的shareId
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.qaiu.util;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -71,4 +72,34 @@ public class CommonUtils {
|
||||
Matcher matcher = pattern.matcher(input);
|
||||
return firstNonEmptyGroup(matcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* urlEncode -> deBase64 -> string
|
||||
* @param encoded 编码后的字符串
|
||||
* @return 解码后的字符串
|
||||
*/
|
||||
public static String urlBase64Decode(String encoded) {
|
||||
try {
|
||||
String urlDecoded = java.net.URLDecoder.decode(encoded, StandardCharsets.UTF_8);
|
||||
byte[] base64DecodedBytes = java.util.Base64.getDecoder().decode(urlDecoded);
|
||||
return new String(base64DecodedBytes, java.nio.charset.StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("URL Base64 解码失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* string -> base64Encode -> urlEncode
|
||||
* @param str 原始字符串
|
||||
* @return 编码后的字符串
|
||||
*/
|
||||
public static String urlBase64Encode(String str) {
|
||||
try {
|
||||
byte[] base64EncodedBytes = java.util.Base64.getEncoder().encode(str.getBytes(java.nio.charset.StandardCharsets.UTF_8));
|
||||
String base64Encoded = new String(base64EncodedBytes, java.nio.charset.StandardCharsets.UTF_8);
|
||||
return java.net.URLEncoder.encode(base64Encoded, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("URL Base64 编码失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -82,7 +82,7 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
<configuration>
|
||||
<!-- <skipTests>true</skipTests> -->
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.parser.clientlink.ClientLinkGeneratorFactory;
|
||||
import cn.qaiu.parser.clientlink.DownloadLinkMeta;
|
||||
import java.util.Map;
|
||||
|
||||
public class TestClientLinks {
|
||||
public static void main(String[] args) {
|
||||
// 创建一个测试用的 ShareLinkInfo,模拟解析器没有实现客户端下载文件元数据的情况
|
||||
ShareLinkInfo shareLinkInfo = ShareLinkInfo.newBuilder()
|
||||
.shareUrl("https://example.com/share/test123")
|
||||
.panName("测试网盘")
|
||||
.type("test")
|
||||
.build();
|
||||
|
||||
// 添加文件名信息(模拟解析器只解析了文件名)
|
||||
shareLinkInfo.getOtherParam().put("fileInfo", new cn.qaiu.entity.FileInfo() {
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "test-file.zip";
|
||||
}
|
||||
});
|
||||
|
||||
// 测试 DownloadLinkMeta.fromShareLinkInfo() 方法
|
||||
DownloadLinkMeta meta = DownloadLinkMeta.fromShareLinkInfo(shareLinkInfo);
|
||||
System.out.println("DownloadLinkMeta: " + meta);
|
||||
System.out.println("Has valid URL: " + meta.hasValidUrl());
|
||||
|
||||
// 测试生成客户端链接
|
||||
Map<cn.qaiu.parser.clientlink.ClientLinkType, String> clientLinks =
|
||||
ClientLinkGeneratorFactory.generateAll(shareLinkInfo);
|
||||
|
||||
System.out.println("Generated client links count: " + clientLinks.size());
|
||||
for (Map.Entry<cn.qaiu.parser.clientlink.ClientLinkType, String> entry : clientLinks.entrySet()) {
|
||||
System.out.println(entry.getKey().getDisplayName() + ": " + entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user