15
15
*
16
16
*/
17
17
public class IzTool extends PanBase {
18
+
18
19
private static final String API_URL_PREFIX = "https://api.ilanzou.com/unproved/" ;
19
20
20
21
private static final String FIRST_REQUEST_URL = API_URL_PREFIX + "recommend/list?devType=6&devModel=Chrome" +
@@ -24,12 +25,38 @@ public class IzTool extends PanBase {
24
25
"&devType=6&uuid={uuid}×tamp={ts}&auth={auth}&shareId={dataKey}" ;
25
26
// downloadId=x&enable=1&devType=6&uuid=x×tamp=x&auth=x&shareId=lGFndCM
26
27
28
+ private static final String VIP_REQUEST_URL = API_URL_PREFIX + "/buy/vip/list?devType=6&devModel=Chrome&uuid" +
29
+ "={uuid}&extra=2×tamp={ts}" ;
30
+ private static final MultiMap header ;
31
+
32
+ static {
33
+ header = MultiMap .caseInsensitiveMultiMap ();
34
+ header .set ("Accept" , "application/json, text/plain, */*" );
35
+ header .set ("Accept-Encoding" , "gzip, deflate, br, zstd" );
36
+ header .set ("Accept-Language" , "zh-CN,zh;q=0.9,en;q=0.8" );
37
+ header .set ("Cache-Control" , "no-cache" );
38
+ header .set ("Connection" , "keep-alive" );
39
+ header .set ("Content-Length" , "0" );
40
+ header .set ("DNT" , "1" );
41
+ header .set ("Host" , "api.ilanzou.com" );
42
+ header .set ("Origin" , "https://www.ilanzou.com/" );
43
+ header .set ("Pragma" , "no-cache" );
44
+ header .set ("Referer" , "https://www.ilanzou.com/" );
45
+ header .set ("Sec-Fetch-Dest" , "empty" );
46
+ header .set ("Sec-Fetch-Mode" , "cors" );
47
+ header .set ("Sec-Fetch-Site" , "cross-site" );
48
+ 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" );
49
+ header .set ("sec-ch-ua" , "\" Google Chrome\" ;v=\" 131\" , \" Chromium\" ;v=\" 131\" , \" Not_A Brand\" ;v=\" 24\" " );
50
+ header .set ("sec-ch-ua-mobile" , "?0" );
51
+ header .set ("sec-ch-ua-platform" , "\" Windows\" " );
52
+ }
53
+
27
54
public IzTool (ShareLinkInfo shareLinkInfo ) {
28
55
super (shareLinkInfo );
29
56
}
30
57
31
58
public Future <String > parse () {
32
- String dataKey = shareLinkInfo .getShareKey ();
59
+ String shareId = shareLinkInfo .getShareKey ();
33
60
long nowTs = System .currentTimeMillis ();
34
61
String tsEncode = AESUtils .encrypt2HexIz (Long .toString (nowTs ));
35
62
String uuid = UUID .randomUUID ().toString ();
@@ -38,45 +65,54 @@ public Future<String> parse() {
38
65
// String shareId = String.valueOf(AESUtils.idEncryptIz(dataKey));
39
66
40
67
// 第一次请求 获取文件信息
41
- // POST https://api.feijipan .com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
42
- client . postAbs ( UriTemplate . of ( FIRST_REQUEST_URL ))
43
- . setTemplateParam ( "shareId" , dataKey )
68
+ // POST https://api.ilanzou .com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
69
+
70
+ client . postAbs ( UriTemplate . of ( VIP_REQUEST_URL ) )
44
71
.setTemplateParam ("uuid" , uuid )
45
72
.setTemplateParam ("ts" , tsEncode )
46
- .send ().onSuccess (res -> {
47
- JsonObject resJson = asJson (res );
48
- if (resJson .getInteger ("code" ) != 200 ) {
49
- fail (FIRST_REQUEST_URL + " 返回异常: " + resJson );
50
- return ;
51
- }
52
- if (resJson .getJsonArray ("list" ).size () == 0 ) {
53
- fail (FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson );
54
- return ;
55
- }
56
- // 文件Id
57
- JsonObject fileInfo = resJson .getJsonArray ("list" ).getJsonObject (0 );
58
- String fileId = fileInfo .getString ("fileIds" );
59
- String userId = fileInfo .getString ("userId" );
60
- // 其他参数
61
- // String fidEncode = AESUtils.encrypt2HexIz(fileId + "|");
62
- String fidEncode = AESUtils .encrypt2HexIz (fileId + "|" + userId );
63
- String auth = AESUtils .encrypt2HexIz (fileId + "|" + nowTs );
64
- // 第二次请求
65
- clientNoRedirects .getAbs (UriTemplate .of (SECOND_REQUEST_URL ))
66
- .setTemplateParam ("fidEncode" , fidEncode )
67
- .setTemplateParam ("uuid" , uuid )
68
- .setTemplateParam ("ts" , tsEncode )
69
- .setTemplateParam ("auth" , auth )
70
- .setTemplateParam ("shareId" , dataKey ).send ().onSuccess (res2 -> {
71
- MultiMap headers = res2 .headers ();
72
- if (!headers .contains ("Location" )) {
73
- fail (SECOND_REQUEST_URL + " 未找到重定向URL: \n " + res .headers ());
74
- return ;
75
- }
76
- promise .complete (headers .get ("Location" ));
77
- }).onFailure (handleFail (SECOND_REQUEST_URL ));
78
- }).onFailure (handleFail (FIRST_REQUEST_URL ));
79
-
73
+ .send ().onSuccess (r0 -> { // 忽略res
74
+ // 第一次请求 获取文件信息
75
+ // POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
76
+ client .postAbs (UriTemplate .of (FIRST_REQUEST_URL ))
77
+ .putHeaders (header )
78
+ .setTemplateParam ("shareId" , shareId )
79
+ .setTemplateParam ("uuid" , uuid )
80
+ .setTemplateParam ("ts" , tsEncode )
81
+ .send ().onSuccess (res -> {
82
+ JsonObject resJson = asJson (res );
83
+ if (resJson .getInteger ("code" ) != 200 ) {
84
+ fail (FIRST_REQUEST_URL + " 返回异常: " + resJson );
85
+ return ;
86
+ }
87
+ if (resJson .getJsonArray ("list" ).size () == 0 ) {
88
+ fail (FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson );
89
+ return ;
90
+ }
91
+ // 文件Id
92
+ JsonObject fileInfo = resJson .getJsonArray ("list" ).getJsonObject (0 );
93
+ String fileId = fileInfo .getString ("fileIds" );
94
+ String userId = fileInfo .getString ("userId" );
95
+ // 其他参数
96
+ // String fidEncode = AESUtils.encrypt2HexIz(fileId + "|");
97
+ String fidEncode = AESUtils .encrypt2HexIz (fileId + "|" + userId );
98
+ String auth = AESUtils .encrypt2HexIz (fileId + "|" + nowTs );
99
+ // 第二次请求
100
+ clientNoRedirects .getAbs (UriTemplate .of (SECOND_REQUEST_URL ))
101
+ .setTemplateParam ("fidEncode" , fidEncode )
102
+ .setTemplateParam ("uuid" , uuid )
103
+ .setTemplateParam ("ts" , tsEncode )
104
+ .setTemplateParam ("auth" , auth )
105
+ .setTemplateParam ("shareId" , shareId )
106
+ .putHeaders (header ).send ().onSuccess (res2 -> {
107
+ MultiMap headers = res2 .headers ();
108
+ if (!headers .contains ("Location" )) {
109
+ fail (SECOND_REQUEST_URL + " 未找到重定向URL: \n " + res .headers ());
110
+ return ;
111
+ }
112
+ promise .complete (headers .get ("Location" ));
113
+ }).onFailure (handleFail (SECOND_REQUEST_URL ));
114
+ }).onFailure (handleFail (FIRST_REQUEST_URL ));
115
+ });
80
116
return promise .future ();
81
117
}
82
118
}
0 commit comments