@@ -136,7 +136,7 @@ public String verify(String shareId, String uk, String pwd, String codeStr, Stri
136
136
}
137
137
138
138
@ SuppressWarnings ({"unchecked" , "rawtypes" })
139
- public DownloadUrl getDLink (String fsId , String shareId , String uk , String pwd , String dir , boolean root , String codeStr , String code ) throws IOException {
139
+ public DownloadUrl getDLink (String shareId , String uk , String pwd , String path , boolean root , String codeStr , String code ) throws IOException {
140
140
String randsk = verify (shareId , uk , pwd , codeStr , code );
141
141
142
142
if (randsk == null ) {
@@ -195,15 +195,17 @@ public DownloadUrl getDLink(String fsId, String shareId, String uk, String pwd,
195
195
196
196
Map resp = objectMapper .readValue (Objects .requireNonNull (client .newCall (request ).execute ().body ()).string (), Map .class );
197
197
if (!root ) {
198
- dir = dir .substring (1 );
199
- dir = dir .substring (dir .indexOf ("/" ));
198
+ path = path .substring (1 );
199
+ path = path .substring (path .indexOf ("/" ));
200
200
201
201
String title = resp .get ("title" ).toString ();
202
202
title = title .substring (1 );
203
203
title = title .substring (0 , title .indexOf ("/" ));
204
- dir = "/" + title + dir ;
204
+ path = "/" + title + path ;
205
205
206
- log .info ("Dir {}," , dir );
206
+ String dir = path .substring (0 , path .lastIndexOf ("/" ));
207
+
208
+ log .info ("Dir {}," , path );
207
209
208
210
url = Objects .requireNonNull (HttpUrl .parse ("https://pan.baidu.com/share/list?shareid=" + shareId )).newBuilder ()
209
211
.addQueryParameter ("uk" , uk )
@@ -240,7 +242,7 @@ public DownloadUrl getDLink(String fsId, String shareId, String uk, String pwd,
240
242
String realDlink = null ;
241
243
log .info ("Resp {}" , resp );
242
244
for (Map <String , Object > dlink : dlinks ) {
243
- if (fsId .equalsIgnoreCase (dlink .get ("fs_id " ).toString ())) {
245
+ if (path .equalsIgnoreCase (dlink .get ("path " ).toString ())) {
244
246
realDlink = dlink .get ("dlink" ).toString ();
245
247
}
246
248
}
0 commit comments