mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 04:13:03 +00:00
1. 动态UA
This commit is contained in:
@@ -96,7 +96,8 @@ public enum PanDomainTemplate {
|
||||
PvyyTool.class),
|
||||
// https://1drv.ms/w/s!Alg0feQmCv2rnRFd60DQOmMa-Oh_?e=buaRtp
|
||||
POD("OneDrive",
|
||||
compile("https://1drv\\.ms/[uw]/s!(?<KEY>.+)"),
|
||||
compile("https://1drv\\.ms/(?<KEY>.+)"),
|
||||
"https://1drv\\.ms/{shareKey}",
|
||||
"https://onedrive.live.com/",
|
||||
PodTool.class),
|
||||
// 404网盘 https://drive.google.com/file/d/xxx/view?usp=sharing
|
||||
@@ -115,8 +116,8 @@ public enum PanDomainTemplate {
|
||||
"https://www.dropbox.com/scl/fi/{shareKey}/?rlkey={pwd}&dl=0",
|
||||
PdbTool.class),
|
||||
P115("115网盘",
|
||||
compile("https://anxia.com/s/(?<KEY>\\w+)(\\?password=(?<PWD>\\w+))?"),
|
||||
"https://anxia.com/s/{shareKey}?password={pwd}",
|
||||
compile("https://(115|anxia).com/s/(?<KEY>\\w+)(\\?password=(?<PWD>\\w+))?"),
|
||||
"https://115.com/s/{shareKey}?password={pwd}",
|
||||
P115Tool.class),
|
||||
// =====================音乐类解析 分享链接标志->MxxS (单歌曲/普通音质)==========================
|
||||
// http://163cn.tv/xxx
|
||||
|
||||
@@ -38,8 +38,6 @@ public class P115Tool extends PanBase {
|
||||
header.set("Sec-Fetch-Dest", "empty");
|
||||
header.set("Sec-Fetch-Mode", "cors");
|
||||
header.set("Sec-Fetch-Site", "cross-site");
|
||||
header.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||
"Chrome/131.0.0.0 Safari/537.36");
|
||||
header.set("sec-ch-ua", "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"");
|
||||
header.set("sec-ch-ua-mobile", "?0");
|
||||
header.set("sec-ch-ua-platform", "\"Windows\"");
|
||||
@@ -53,6 +51,7 @@ public class P115Tool extends PanBase {
|
||||
// 第一次请求 获取文件信息
|
||||
client.getAbs(UriTemplate.of(FIRST_REQUEST_URL))
|
||||
.putHeaders(header)
|
||||
.putHeader("User-Agent", shareLinkInfo.getOtherParam().get("UA").toString())
|
||||
.setTemplateParam("dataKey", shareLinkInfo.getShareKey())
|
||||
.setTemplateParam("dataPwd", shareLinkInfo.getSharePassword())
|
||||
.send().onSuccess(res -> {
|
||||
@@ -68,8 +67,8 @@ public class P115Tool extends PanBase {
|
||||
// 第二次请求
|
||||
// share_code={dataKey}&receive_code={dataPwd}&file_id={file_id}
|
||||
client.postAbs(SECOND_REQUEST_URL)
|
||||
.putHeaders(header)
|
||||
.putHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
|
||||
.putHeader("User-Agent", shareLinkInfo.getOtherParam().get("UA").toString())
|
||||
.sendForm(MultiMap.caseInsensitiveMultiMap()
|
||||
.set("share_code", shareLinkInfo.getShareKey())
|
||||
.set("receive_code", shareLinkInfo.getSharePassword())
|
||||
|
||||
@@ -230,29 +230,4 @@ public class PodTool extends PanBase {
|
||||
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
|
||||
//https://onedrive.live.com/redir?resid=ABFD0A26E47D3458!4699&e=OggA4s&migratedtospo=true&redeem=aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBbGcwZmVRbUN2MnJwRnZ1NDQ0aGc1eVZxRGNLP2U9T2dnQTRz
|
||||
public static void main(String[] args) {
|
||||
// Matcher matcher = redirectUrlRegex.matcher("https://onedrive.live.com/redir?resid=ABFD0A26E47D3458!4698" +
|
||||
// "&authkey=!ACpvXghP5xhG_cg&e=hV98W1");
|
||||
// if (matcher.find()) {
|
||||
// System.out.println(matcher.group("cid"));
|
||||
// System.out.println(matcher.group("cid2"));
|
||||
// System.out.println(matcher.group("authkey"));
|
||||
// }
|
||||
// appid 5cbed6ac-a083-4e14-b191-b4ba07653de2 5cbed6ac-a083-4e14-b191-b4ba07653de2
|
||||
// https://my.microsoftpersonalcontent.com/personal/abfd0a26e47d3458/_layouts/15/embed.aspx?UniqueId=e47d3458-0a26-20fd-80ab-5b1200000000&Translate=false&ApiVersion=2.0
|
||||
// https://my.microsoftpersonalcontent.com/personal/abfd0a26e47d3458/_layouts/15/embed.aspx?UniqueId=6b0900d6-abcf-44ce-b7bf-7b626bcbe4b8&Translate=false&ApiVersion=2.0
|
||||
// https://1drv.ms/u/s!Alg0feQmCv2rpFvu444hg5yVqDcK?e=OggA4s
|
||||
// https://1drv.ms/u/c/abfd0a26e47d3458/EVg0feQmCv0ggKtbEgAAAAABqGv8K6HmOwLRsvokyV5fUg?e=iqoRc0
|
||||
// https://1drv.ms/u/c/abfd0a26e47d3458/EVg0feQmCv0ggKtaEgAAAAAB-lF1qjkfv5OqdrT9VSMDMw
|
||||
new PodTool(ShareLinkInfo.newBuilder().shareUrl("https://1drv.ms/x/c/abfd0a26e47d3458" +
|
||||
"/EVg0feQmCv0ggKtxEQAAAAABTPEeC16_fMDbNEN8Du4mkQ?e=Ao2uSU")
|
||||
.build())
|
||||
.parse().onSuccess(res -> {
|
||||
System.out.println(res);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
28
parser/src/test/java/cn/qaiu/parser/ParserUrlOut.java
Normal file
28
parser/src/test/java/cn/qaiu/parser/ParserUrlOut.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package cn.qaiu.parser;
|
||||
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.parser.impl.PodTool;
|
||||
|
||||
public class ParserUrlOut {
|
||||
|
||||
//https://onedrive.live.com/redir?resid=ABFD0A26E47D3458!4699&e=OggA4s&migratedtospo=true&redeem=aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBbGcwZmVRbUN2MnJwRnZ1NDQ0aGc1eVZxRGNLP2U9T2dnQTRz
|
||||
public static void main(String[] args) {
|
||||
// Matcher matcher = redirectUrlRegex.matcher("https://onedrive.live.com/redir?resid=ABFD0A26E47D3458!4698" +
|
||||
// "&authkey=!ACpvXghP5xhG_cg&e=hV98W1");
|
||||
// if (matcher.find()) {
|
||||
// System.out.println(matcher.group("cid"));
|
||||
// System.out.println(matcher.group("cid2"));
|
||||
// System.out.println(matcher.group("authkey"));
|
||||
// }
|
||||
// appid 5cbed6ac-a083-4e14-b191-b4ba07653de2 5cbed6ac-a083-4e14-b191-b4ba07653de2
|
||||
// https://my.microsoftpersonalcontent.com/personal/abfd0a26e47d3458/_layouts/15/embed.aspx?UniqueId=e47d3458-0a26-20fd-80ab-5b1200000000&Translate=false&ApiVersion=2.0
|
||||
// https://my.microsoftpersonalcontent.com/personal/abfd0a26e47d3458/_layouts/15/embed.aspx?UniqueId=6b0900d6-abcf-44ce-b7bf-7b626bcbe4b8&Translate=false&ApiVersion=2.0
|
||||
// https://1drv.ms/u/s!Alg0feQmCv2rpFvu444hg5yVqDcK?e=OggA4s
|
||||
// https://1drv.ms/u/c/abfd0a26e47d3458/EVg0feQmCv0ggKtbEgAAAAABqGv8K6HmOwLRsvokyV5fUg?e=iqoRc0
|
||||
// https://1drv.ms/u/c/abfd0a26e47d3458/EVg0feQmCv0ggKtaEgAAAAAB-lF1qjkfv5OqdrT9VSMDMw
|
||||
new PodTool(ShareLinkInfo.newBuilder().shareUrl("https://1drv.ms/u/c/abfd0a26e47d3458/EdYACWvPq85Et797YmvL5LgBruUKoNxqIFATXhIv1PI2_Q")
|
||||
.build())
|
||||
.parse().onSuccess(System.out::println);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -298,8 +298,14 @@
|
||||
host: /118pan\.com/,
|
||||
name: '118网盘'
|
||||
},
|
||||
pan115: {
|
||||
// https://115.com/s/swhyiia3wzi?password=h374
|
||||
reg: /https:\/\/(115|anxia)\.com\/s\/.+/,
|
||||
host: /115pan\.com/,
|
||||
name: '115网盘'
|
||||
},
|
||||
onedrive: {
|
||||
reg: /https:\/\/1drv\.ms\/[uw]\/s!.+/,
|
||||
reg: /https:\/\/1drv\.ms\/.+/,
|
||||
host: /1drv\.ms/,
|
||||
name: 'OneDrive'
|
||||
},
|
||||
|
||||
@@ -12,6 +12,8 @@ import io.vertx.core.Future;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.http.HttpServerRequest;
|
||||
import io.vertx.core.http.HttpServerResponse;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@@ -27,11 +29,11 @@ public class ServerApi {
|
||||
private final CacheService cacheService = AsyncServiceUtil.getAsyncServiceInstance(CacheService.class);
|
||||
|
||||
@RouteMapping(value = "/parser", method = RouteMethod.GET, order = 1)
|
||||
public Future<Void> parse(HttpServerResponse response, HttpServerRequest request, String pwd) {
|
||||
public Future<Void> parse(HttpServerResponse response, HttpServerRequest request, RoutingContext rcx, String pwd) {
|
||||
Promise<Void> promise = Promise.promise();
|
||||
String url = URLParamUtil.parserParams(request);
|
||||
|
||||
cacheService.getCachedByShareUrlAndPwd(url, pwd)
|
||||
cacheService.getCachedByShareUrlAndPwd(url, pwd, JsonObject.of("UA",request.headers().get("user-agent")))
|
||||
.onSuccess(res -> ResponseUtil.redirect(
|
||||
response.putHeader("nfd-cache-hit", res.getCacheHit().toString())
|
||||
.putHeader("nfd-cache-expires", res.getExpires()),
|
||||
@@ -43,22 +45,22 @@ public class ServerApi {
|
||||
@RouteMapping(value = "/json/parser", method = RouteMethod.GET, order = 1)
|
||||
public Future<CacheLinkInfo> parseJson(HttpServerRequest request, String pwd) {
|
||||
String url = URLParamUtil.parserParams(request);
|
||||
return cacheService.getCachedByShareUrlAndPwd(url, pwd);
|
||||
return cacheService.getCachedByShareUrlAndPwd(url, pwd, JsonObject.of("UA",request.headers().get("user-agent")));
|
||||
}
|
||||
|
||||
@RouteMapping(value = "/json/:type/:key", method = RouteMethod.GET)
|
||||
public Future<CacheLinkInfo> parseKeyJson(String type, String key) {
|
||||
public Future<CacheLinkInfo> parseKeyJson(HttpServerRequest request, String type, String key) {
|
||||
String pwd = "";
|
||||
if (key.contains("@")) {
|
||||
String[] keys = key.split("@");
|
||||
key = keys[0];
|
||||
pwd = keys[1];
|
||||
}
|
||||
return cacheService.getCachedByShareKeyAndPwd(type, key, pwd);
|
||||
return cacheService.getCachedByShareKeyAndPwd(type, key, pwd, JsonObject.of("UA",request.headers().get("user-agent")));
|
||||
}
|
||||
|
||||
@RouteMapping(value = "/:type/:key", method = RouteMethod.GET)
|
||||
public Future<Void> parseKey(HttpServerResponse response, String type, String key) {
|
||||
public Future<Void> parseKey(HttpServerResponse response, HttpServerRequest request, String type, String key) {
|
||||
Promise<Void> promise = Promise.promise();
|
||||
String pwd = "";
|
||||
if (key.contains("@")) {
|
||||
@@ -66,7 +68,7 @@ public class ServerApi {
|
||||
key = keys[0];
|
||||
pwd = keys[1];
|
||||
}
|
||||
cacheService.getCachedByShareKeyAndPwd(type, key, pwd)
|
||||
cacheService.getCachedByShareKeyAndPwd(type, key, pwd, JsonObject.of("UA",request.headers().get("user-agent")))
|
||||
.onSuccess(res -> ResponseUtil.redirect(
|
||||
response.putHeader("nfd-cache-hit", res.getCacheHit().toString())
|
||||
.putHeader("nfd-cache-expires", res.getExpires()),
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.qaiu.lz.web.model.CacheLinkInfo;
|
||||
import cn.qaiu.vx.core.base.BaseAsyncService;
|
||||
import io.vertx.codegen.annotations.ProxyGen;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
|
||||
/**
|
||||
* @author <a href="https://qaiu.top">QAIU</a>
|
||||
@@ -12,7 +13,7 @@ import io.vertx.core.Future;
|
||||
@ProxyGen
|
||||
public interface CacheService extends BaseAsyncService {
|
||||
|
||||
Future<CacheLinkInfo> getCachedByShareKeyAndPwd(String type, String shareKey, String pwd);
|
||||
Future<CacheLinkInfo> getCachedByShareKeyAndPwd(String type, String shareKey, String pwd, JsonObject otherParam);
|
||||
|
||||
Future<CacheLinkInfo> getCachedByShareUrlAndPwd(String shareUrl, String pwd);
|
||||
Future<CacheLinkInfo> getCachedByShareUrlAndPwd(String shareUrl, String pwd, JsonObject otherParam);
|
||||
}
|
||||
|
||||
@@ -76,14 +76,16 @@ public class CacheServiceImpl implements CacheService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<CacheLinkInfo> getCachedByShareKeyAndPwd(String type, String shareKey, String pwd) {
|
||||
public Future<CacheLinkInfo> getCachedByShareKeyAndPwd(String type, String shareKey, String pwd, JsonObject otherParam) {
|
||||
ParserCreate parserCreate = ParserCreate.fromType(type).shareKey(shareKey).setShareLinkInfoPwd(pwd);
|
||||
parserCreate.getShareLinkInfo().getOtherParam().putAll(otherParam.getMap());
|
||||
return getAndSaveCachedShareLink(parserCreate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<CacheLinkInfo> getCachedByShareUrlAndPwd(String shareUrl, String pwd) {
|
||||
public Future<CacheLinkInfo> getCachedByShareUrlAndPwd(String shareUrl, String pwd, JsonObject otherParam) {
|
||||
ParserCreate parserCreate = ParserCreate.fromShareUrl(shareUrl).setShareLinkInfoPwd(pwd);
|
||||
parserCreate.getShareLinkInfo().getOtherParam().putAll(otherParam.getMap());
|
||||
return getAndSaveCachedShareLink(parserCreate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,23 +68,7 @@ Cookie:XSRF-TOKEN=eyJpdiI6ImVpdW9XOFwvazVka0xRQ2JUQ1p4c1dRPT0iLCJ2YWx1ZSI6Im1NcT
|
||||
# -H 'sec-ch-ua-platform: "Windows"'
|
||||
# --data-raw 'share_code=swhyiia3wzi&receive_code=h374&file_id=2532636713782843636'
|
||||
POST https://anxia.com/webapi/share/skip_login_downurl
|
||||
Accept: application/json, text/javascript, */*; q=0.01
|
||||
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
|
||||
Cache-Control: no-cache
|
||||
Connection: keep-alive
|
||||
Cookie: acw_tc=2f6a1fdb17343237335965711ee089dd42f90058dbad48c86a96931b7098b0
|
||||
DNT: 1
|
||||
Origin: https://anxia.com
|
||||
Pragma: no-cache
|
||||
Referer: https://anxia.com/s/swhyiia3wzi?password=h374
|
||||
Sec-Fetch-Dest: empty
|
||||
Sec-Fetch-Mode: cors
|
||||
Sec-Fetch-Site: same-origin
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
|
||||
X-Requested-With: XMLHttpRequest
|
||||
sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"
|
||||
sec-ch-ua-mobile: ?0
|
||||
sec-ch-ua-platform: "Windows"
|
||||
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
|
||||
|
||||
share_code=swhyiia3wzi&receive_code=h374&file_id=2532636713782843636
|
||||
@@ -126,5 +110,36 @@ sec-ch-ua-mobile: ?0
|
||||
sec-ch-ua-platform: "Windows"
|
||||
|
||||
###
|
||||
# curl 'https://cdnfhnfile.115.com/63a79fdca011d11b46d5fda83f6fdf7fe5141ec7/%E6%95%B0%E5%AD%A612%E6%9C%8819%E6%97%A5-12%E6%9C%8823%E6%97%A5%E7%BA%BF%E4%B8%8A%E8%B5%84%E6%BA%90.zip?t=1734331803&u=ip976768882&s=512000&d=976768882--0&c=1&f=1&k=89f2b6ec6839999b3e7edc2b6ac85066&us=512000&uc=0&v=1'
|
||||
# -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7'
|
||||
# -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8'
|
||||
# -H 'Cache-Control: no-cache'
|
||||
# -H 'Connection: keep-alive'
|
||||
# -H 'DNT: 1'
|
||||
# -H 'Pragma: no-cache'
|
||||
# -H 'Referer: https://anxia.com/'
|
||||
# -H 'Sec-Fetch-Dest: document'
|
||||
# -H 'Sec-Fetch-Mode: navigate'
|
||||
# -H 'Sec-Fetch-Site: cross-site'
|
||||
# -H 'Sec-Fetch-User: ?1'
|
||||
# -H 'Upgrade-Insecure-Requests: 1'
|
||||
# -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
|
||||
# -H 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"'
|
||||
# -H 'sec-ch-ua-mobile: ?0'
|
||||
# -H 'sec-ch-ua-platform: "Windows"'
|
||||
# @no-cookie-jar
|
||||
# @no-redirect
|
||||
GET https://cdnfhnfile.115.com/63a79fdca011d11b46d5fda83f6fdf7fe5141ec7/%E6%95%B0%E5%AD%A612%E6%9C%8819%E6%97%A5-12%E6%9C%8823%E6%97%A5%E7%BA%BF%E4%B8%8A%E8%B5%84%E6%BA%90.zip?t=1734331803&u=ip976768882&s=512000&d=976768882--0&c=1&f=1&k=89f2b6ec6839999b3e7edc2b6ac85066&us=512000&uc=0&v=1
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
|
||||
|
||||
|
||||
###
|
||||
# @no-cookie-jar
|
||||
# @no-redirect
|
||||
GET https://cdnfhnfile.115.com/63a79fdca011d11b46d5fda83f6fdf7fe5141ec7/%E6%95%B0%E5%AD%A612%E6%9C%8819%E6%97%A5-12%E6%9C%8823%E6%97%A5%E7%BA%BF%E4%B8%8A%E8%B5%84%E6%BA%90.zip?t=1734332086&u=ip976768882&s=512000&d=976768882--0&c=1&f=1&k=28e2b7be1a91ff0715dd92c6a9ec592f&us=512000&uc=0&v=1
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
|
||||
|
||||
|
||||
###
|
||||
https://cdnfhnfile.115.com/63a79fdca011d11b46d5fda83f6fdf7fe5141ec7/%E6%95%B0%E5%AD%A612%E6%9C%8819%E6%97%A5-12%E6%9C%8823%E6%97%A5%E7%BA%BF%E4%B8%8A%E8%B5%84%E6%BA%90.zip?t=1734336235&u=ip976768882&s=512000&d=976768882--0&c=1&f=1&k=89c7796e0906aca3eecccbd545775653&us=512000&uc=0&v=1
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
|
||||
|
||||
Reference in New Issue
Block a user