ucToken
This commit is contained in:
parent
a7df1822f0
commit
72d562fb6f
|
|
@ -700,7 +700,7 @@ public class UCApi {
|
|||
//token不为空
|
||||
if (StringUtils.isNoneBlank(cookieToken)) {
|
||||
SpiderDebug.log("cookieToken不为空: " + cookieToken + ";开始下载");
|
||||
qrCodeHandler.download(cookieToken, this.saveFileIdCaches.get(fileId));
|
||||
return qrCodeHandler.download(cookieToken, this.saveFileIdCaches.get(fileId));
|
||||
} else {
|
||||
Map<String, Object> down = Json.parseSafe(api("file/download?" + this.pr + "&uc_param_str=", Collections.emptyMap(), Map.of("fids", List.of(this.saveFileIdCaches.get(fileId))), 0, "POST"), Map.class);
|
||||
if (down.get("data") != null) {
|
||||
|
|
|
|||
|
|
@ -224,16 +224,17 @@ public class UCTokenHandler {
|
|||
return Map.of("status", "EXPIRED");
|
||||
}
|
||||
|
||||
public void download(String token, String saveFileId) throws Exception {
|
||||
public String download(String token, String saveFileId) throws Exception {
|
||||
SpiderDebug.log("开始下载:" + saveFileId + ";token:" + token);
|
||||
String pathname = "/file";
|
||||
String timestamp = Long.toString(System.currentTimeMillis() / 1000);
|
||||
String timestamp = String.valueOf(new Date().getTime() / 1000 + 1) + "000";
|
||||
String deviceID = StringUtils.isAllBlank((String) addition.get("DeviceID")) ? (String) addition.get("DeviceID") : generateDeviceID(timestamp);
|
||||
String reqId = generateReqId(deviceID, timestamp);
|
||||
String xPanToken = generateXPanToken("GET", pathname, timestamp, (String) conf.get("signKey"));
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Accept-Encoding", "gzip");
|
||||
//headers.put("Accept-Encoding", "gzip");
|
||||
headers.put("content-type", "text/plain;charset=UTF-8");
|
||||
headers.put("User-Agent", "Mozilla/5.0 (Linux; U; Android 13; zh-cn; M2004J7AC Build/UKQ1.231108.001) AppleWebKit/533.1 (KHTML, like Gecko) Mobile Safari/533.1");
|
||||
headers.put("x-pan-tm", timestamp);
|
||||
headers.put("x-pan-token", xPanToken);
|
||||
|
|
@ -254,15 +255,17 @@ public class UCTokenHandler {
|
|||
params.put("device_gpu", "Adreno (TM) 550");
|
||||
params.put("activity_rect", URLEncoder.encode("{}", "UTF-8"));
|
||||
params.put("channel", (String) conf.get("channel"));
|
||||
params.put("method", "streaming");
|
||||
params.put("method", "download");
|
||||
params.put("group_by", "source");
|
||||
params.put("fid", saveFileId);
|
||||
params.put("resolution", "low,normal,high,super,2k,4k");
|
||||
params.put("support", "dolby_vision");
|
||||
|
||||
OkResult okResult1 = OkHttp.get(API_URL + pathname, params, headers);
|
||||
SpiderDebug.log("uc TV 下载文件内容:" + okResult1.getBody());
|
||||
|
||||
JsonObject obj = Json.safeObject(okResult1.getBody());
|
||||
String downloadUrl = obj.get("data").getAsJsonObject().get("download_url").getAsString();
|
||||
SpiderDebug.log("uc TV 下载文件内容:" + downloadUrl);
|
||||
return downloadUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,11 +31,8 @@ public class QRCodeHandlerTest {
|
|||
public void download() throws Exception {
|
||||
// Mock the OkHttp.get method to return a predefined OkResult
|
||||
// Execute the method under test
|
||||
String result = qrCodeHandler.download();
|
||||
System.out.println(result);
|
||||
while(true){
|
||||
qrCodeHandler.download("eyJhbGciOiJIUzI1NiIsIlR5cGUiOiJKd3QiLCJ0eXAiOiJKV1QifQ.eyJvcGVuSWQiOiJkMTQ4MjM1MmFiMWU0NmYwOGQ3M2VmYzQyYWRiOTgxNSIsImV4cCI6MTc0MjUyNjU1MiwidG9rZW4iOiJkZmEwMjI2YzJmNDQ0ZTlmYTAxNzYxNGVhMDVkODczOCJ9.mUlFZdgSfACjZaBsmYNdgZSY7eSy4_hI3oZ8niq36Xs","c31c86354605487cbb077a59d3bfa8ad");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
5aa6527331d90b59ad20a2d055a23226
|
||||
2aea627a032d146b98e9892524ee65e8
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;5aa6527331d90b59ad20a2d055a23226",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;2aea627a032d146b98e9892524ee65e8",
|
||||
"lives": [
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;5aa6527331d90b59ad20a2d055a23226",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;2aea627a032d146b98e9892524ee65e8",
|
||||
"lives": [
|
||||
{
|
||||
"name": "直播ipv6",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;5aa6527331d90b59ad20a2d055a23226",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;2aea627a032d146b98e9892524ee65e8",
|
||||
"lives": [
|
||||
{
|
||||
"name": "直播ipv6",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;5aa6527331d90b59ad20a2d055a23226",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;2aea627a032d146b98e9892524ee65e8",
|
||||
"lives": [
|
||||
{
|
||||
"name": "直播",
|
||||
|
|
|
|||
Loading…
Reference in New Issue