Update ali delete by auth

pull/69/head
FongMi 3 years ago
parent 3574b0ef56
commit ca8f7ef682
  1. 24
      app/src/main/java/com/github/catvod/ali/API.java
  2. BIN
      jar/custom_spider.jar
  3. 2
      jar/custom_spider.jar.md5

@ -351,10 +351,11 @@ public class API {
body.put("drive_id", user.getDriveId());
return new JSONObject(oauth("openFile/getDownloadUrl", body.toString(), true)).getString("url");
} catch (Exception e) {
Init.execute(this::deleteAll);
e.printStackTrace();
return "";
} finally {
deleteAll();
Init.execute(this::deleteAll);
}
}
@ -370,10 +371,11 @@ public class API {
JSONArray taskList = new JSONObject(json).getJSONObject("video_preview_play_info").getJSONArray("live_transcoding_task_list");
return getPreviewQuality(taskList, flag);
} catch (Exception e) {
Init.execute(this::deleteAll);
e.printStackTrace();
return "";
} finally {
deleteAll();
Init.execute(this::deleteAll);
}
}
@ -396,21 +398,15 @@ public class API {
}
private void deleteAll() {
for (String tempId : tempIds) if (!TextUtils.isEmpty(tempId)) delete(tempId);
for (String tempId : tempIds) delete(tempId);
}
private void delete(String fileId) {
try {
SpiderDebug.log("Delete..." + fileId);
JSONObject body = new JSONObject();
body.put("file_id", fileId);
body.put("drive_id", user.getDriveId());
String result = oauth("openFile/delete", body.toString(), true);
SpiderDebug.log(result + "," + result.length());
if (result.length() == 125) tempIds.remove(fileId);
} catch (Exception e) {
e.printStackTrace();
}
SpiderDebug.log("Delete..." + fileId);
String json = "{\"requests\":[{\"body\":{\"drive_id\":\"%s\",\"file_id\":\"%s\"},\"headers\":{\"Content-Type\":\"application/json\"},\"id\":\"%s\",\"method\":\"POST\",\"url\":\"/file/delete\"}],\"resource\":\"file\"}";
json = String.format(json, user.getDriveId(), fileId, fileId);
String result = auth("adrive/v2/batch", json, true);
if (result.length() == 211) tempIds.remove(fileId);
}
public Object[] proxySub(Map<String, String> params) {

Binary file not shown.

@ -1 +1 @@
be4d70b1bec4f2c930972aa6685ffe19
130be941d3dc5eace206287935bd5ccd

Loading…
Cancel
Save