Update ali delete by auth

This commit is contained in:
FongMi 2023-04-13 11:49:57 +08:00
parent 0276e630ae
commit 190aac767b
5 changed files with 13 additions and 17 deletions

View File

@ -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.

View File

@ -1 +1 @@
be4d70b1bec4f2c930972aa6685ffe19
130be941d3dc5eace206287935bd5ccd

View File

@ -1,5 +1,5 @@
{
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;be4d70b1bec4f2c930972aa6685ffe19",
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;130be941d3dc5eace206287935bd5ccd",
"wallpaper": "https://gao.chuqiuyu.tk",
"sites": [
{

View File

@ -1,5 +1,5 @@
{
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;be4d70b1bec4f2c930972aa6685ffe19",
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;130be941d3dc5eace206287935bd5ccd",
"wallpaper": "http://饭太硬.ga/深色壁纸/api.php",
"sites": [
{