diff --git a/app/src/main/java/com/github/catvod/ali/API.java b/app/src/main/java/com/github/catvod/ali/API.java index 8979b496..7a2d3d53 100644 --- a/app/src/main/java/com/github/catvod/ali/API.java +++ b/app/src/main/java/com/github/catvod/ali/API.java @@ -170,8 +170,9 @@ public class API { body.put("code", code); body.put("grant_type", "authorization_code"); object = new JSONObject(post("https://api.nn.ci/alist/ali_open/code", body)); + auth.setAccessTokenOpen(object.optString("token_type") + " " + object.optString("access_token")); auth.setRefreshTokenOpen(object.getString("refresh_token")); - refreshOpenToken(); + auth.save(); return true; } catch (Exception e) { SpiderDebug.log(e); @@ -184,18 +185,6 @@ public class API { } } - private void refreshOpenToken() throws Exception { - SpiderDebug.log("refreshAccessTokenOpen..."); - JSONObject body = new JSONObject(); - String token = auth.getRefreshTokenOpen(); - body.put("refresh_token", token); - body.put("grant_type", "refresh_token"); - JSONObject object = new JSONObject(OkHttp.postJson("https://api.nn.ci/alist/ali_open/token", body.toString(), getHeader())); - auth.setAccessTokenOpen(object.optString("token_type") + " " + object.optString("access_token")); - auth.setRefreshTokenOpen(object.optString("refresh_token")); - auth.save(); - } - public boolean refreshShareToken() { try { SpiderDebug.log("refreshShareToken..."); @@ -246,7 +235,7 @@ public class API { List files = new ArrayList<>(); LinkedHashMap> subMap = new LinkedHashMap<>(); listFiles(new Item(getParentFileId(fileId, object)), files, subMap); - List playFrom = Arrays.asList("原畫", "FHD", "HD", "SD", "LD"); + List playFrom = Arrays.asList("原畫", "高清", "標清"); List episode = new ArrayList<>(); List playUrl = new ArrayList<>(); for (Item file : files) episode.add(Trans.get(file.getDisplayName()) + "$" + file.getFileId() + findSubs(file.getName(), subMap)); @@ -334,7 +323,7 @@ public class API { } public String getPreviewUrl(String fileId, String flag) { - return Proxy.getUrl() + "?do=ali&type=m3u8&file_id=" + fileId + "&flag=" + flag; + return Proxy.getUrl() + "?do=ali&type=m3u8&file_id=" + fileId + "&flag=" + (flag.equals("高清") ? "FHD" : "HD"); } public String getDownloadUrl(String fileId) {