pull/69/head
FongMi 3 years ago
parent de0d6af3fd
commit fde087f1be
  1. 1
      app/build.gradle
  2. 20
      app/src/main/java/com/github/catvod/ali/API.java
  3. 3
      gradle.properties
  4. BIN
      jar/custom_spider.jar
  5. 2
      jar/custom_spider.jar.md5

@ -12,6 +12,7 @@ android {
targetSdk 29
ndk { abiFilters "armeabi-v7a" }
buildConfigField("String", "APP_ID", "\"${appId}\"")
buildConfigField("String", "CLIENT_ID", "\"${clientId}\"")
}
buildTypes {

@ -116,16 +116,16 @@ public class API {
return result;
}
private String authOpen(String url, JSONObject body, boolean retry) {
String result = OkHttp.postJson(url, body.toString(), getHeaderAuthOpen());
if (retry && check401Open(result)) return authOpen(url, body, false);
private String authOpen(String url, String json, boolean retry) {
String result = OkHttp.postJson(url, json, getHeaderAuthOpen());
if (retry && check401Open(result)) return authOpen(url, json, false);
return result;
}
private String sign(String url, JSONObject body, boolean retry) {
private String sign(String url, String json, boolean retry) {
url = url.startsWith("https") ? url : "https://api.aliyundrive.com/" + url;
String result = OkHttp.postJson(url, body.toString(), getHeaderSign());
if (retry && check401(result)) return sign(url, body, false);
String result = OkHttp.postJson(url, json, getHeaderSign());
if (retry && check401(result)) return sign(url, json, false);
return result;
}
@ -170,7 +170,7 @@ public class API {
body = new JSONObject();
body.put("authorize", 1);
body.put("scope", "user:base,file:all:read,file:all:write");
object = new JSONObject(auth("https://open.aliyundrive.com/oauth/users/authorize?client_id=76917ccccd4441c39457a04f6084fb2f&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=", body, false));
object = new JSONObject(auth("https://open.aliyundrive.com/oauth/users/authorize?client_id=" + BuildConfig.CLIENT_ID + "&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=", body, false));
String code = object.toString().substring(object.toString().indexOf("code=") + 5, 104);
//OAuth Redirect
body = new JSONObject();
@ -234,7 +234,7 @@ public class API {
body.put("nonce", 0);
body.put("pubKey", pubKey);
body.put("refreshToken", auth.getRefreshToken());
JSONObject object = new JSONObject(sign("users/v1/users/device/create_session", body, false));
JSONObject object = new JSONObject(sign("users/v1/users/device/create_session", body.toString(), false));
if (!object.getBoolean("success")) throw new Exception(object.toString());
return true;
} catch (Exception e) {
@ -358,7 +358,7 @@ public class API {
JSONObject body = new JSONObject();
body.put("file_id", fileId);
body.put("drive_id", auth.getDriveId());
String url = new JSONObject(authOpen("https://open.aliyundrive.com/adrive/v1.0/openFile/getDownloadUrl", body, true)).optString("url");
String url = new JSONObject(authOpen("https://open.aliyundrive.com/adrive/v1.0/openFile/getDownloadUrl", body.toString(), true)).optString("url");
delete(fileId);
return url;
}
@ -428,7 +428,7 @@ public class API {
body.put("share_id", auth.getShareId());
body.put("template_id", "");
body.put("category", "live_transcoding");
String json = sign("v2/file/get_share_link_video_preview_play_info", body, true);
String json = sign("v2/file/get_share_link_video_preview_play_info", body.toString(), true);
JSONArray taskList = new JSONObject(json).getJSONObject("video_preview_play_info").getJSONArray("live_transcoding_task_list");
Map<String, List<String>> respHeaders = new HashMap<>();
OkHttp.stringNoRedirect(getPreviewQuality(taskList, flag), getHeader(), respHeaders);

@ -19,4 +19,5 @@ android.useAndroidX=true
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
appId=5dde4e1bdf9e4966b387ba58f4b3fdc3
appId=5dde4e1bdf9e4966b387ba58f4b3fdc3
clientId=76917ccccd4441c39457a04f6084fb2f

Binary file not shown.

@ -1 +1 @@
1862134a5028c5720a5c9eb24245144a
45d9462277175c390ccab72992b8c917

Loading…
Cancel
Save