Clean ali
This commit is contained in:
parent
e3ce770ebf
commit
3b6ad517ad
|
|
@ -4,7 +4,6 @@ import android.app.Activity;
|
|||
import android.os.Bundle;
|
||||
|
||||
import com.github.catvod.R;
|
||||
import com.github.catvod.spider.Ali;
|
||||
import com.github.catvod.spider.Init;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
|
@ -15,9 +14,7 @@ public class MainActivity extends Activity {
|
|||
setContentView(R.layout.activity_main);
|
||||
Init.init(getApplicationContext());
|
||||
new Thread(() -> {
|
||||
Ali ali = new Ali();
|
||||
ali.init("https://agit.ai/Yoursmile7/TVBox/raw/branch/master/token.txt");
|
||||
ali.playerContent("普畫", "63de1c59a77dc671045c4a35b42e96d5621f4dc0");
|
||||
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ public class OkHttp {
|
|||
return new OkHttpClient.Builder().dns(safeDns()).readTimeout(30, TimeUnit.SECONDS).writeTimeout(30, TimeUnit.SECONDS).connectTimeout(30, TimeUnit.SECONDS).hostnameVerifier(SSLSocketFactoryCompat.hostnameVerifier).sslSocketFactory(new SSLSocketFactoryCompat(), SSLSocketFactoryCompat.trustAllCert);
|
||||
}
|
||||
|
||||
private static OkHttpClient client() {
|
||||
public static OkHttpClient client() {
|
||||
return get().client;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
|
@ -79,8 +78,6 @@ public class Ali {
|
|||
headers.put("content-type", "application/json");
|
||||
headers.put("Authorization", auth.getAccessToken());
|
||||
headers.put("x-share-token", auth.getShareToken());
|
||||
headers.put("x-device-id", auth.getDeviceId());
|
||||
headers.put("x-signature", auth.getSignature());
|
||||
return headers;
|
||||
}
|
||||
|
||||
|
|
@ -117,11 +114,7 @@ public class Ali {
|
|||
public String playerContent(String flag, String id) {
|
||||
String[] ids = id.split("\\+");
|
||||
if (auth.isEmpty()) refreshAccessToken();
|
||||
if (flag.equals("原畫")) {
|
||||
return Result.get().url(getDownloadUrl(ids[0])).subs(getSub(ids)).header(getHeaders()).string();
|
||||
} else {
|
||||
return Result.get().url(getPreviewUrl(ids[0])).subs(getSub(ids)).header(getHeaders()).string();
|
||||
}
|
||||
}
|
||||
|
||||
private Vod getVod(String url, String fileId) throws Exception {
|
||||
|
|
@ -143,7 +136,7 @@ public class Ali {
|
|||
vod.setVodPic(object.getString("avatar"));
|
||||
vod.setVodName(object.getString("share_name"));
|
||||
vod.setVodPlayUrl(TextUtils.join("$$$", sourceUrls));
|
||||
vod.setVodPlayFrom("原畫$$$普畫");
|
||||
vod.setVodPlayFrom("原畫");
|
||||
vod.setTypeName("阿里雲盤");
|
||||
return vod;
|
||||
}
|
||||
|
|
@ -203,7 +196,6 @@ public class Ali {
|
|||
auth.setDeviceId(object.getString("device_id"));
|
||||
auth.setAccessToken(object.getString("token_type") + " " + object.getString("access_token"));
|
||||
auth.setRefreshToken(object.getString("refresh_token"));
|
||||
generateSign();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
stopService();
|
||||
|
|
@ -215,20 +207,6 @@ public class Ali {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* secpAppID := "5dde4e1bdf9e4966b387ba58f4b3fdc3"
|
||||
* singdata := fmt.Sprintf("%s:%s:%s:%d", secpAppID, state.deviceID, d.UserID, state.nonce)
|
||||
* hash := sha256.Sum256([]byte(singdata))
|
||||
* data, _ := ecc.SignBytes(state.privateKey, hash[:], ecc.RecID|ecc.LowerS)
|
||||
* state.signature = hex.EncodeToString(data)
|
||||
* */
|
||||
private void generateSign() throws Exception {
|
||||
String appID = "5dde4e1bdf9e4966b387ba58f4b3fdc3";
|
||||
String signData = String.format(Locale.getDefault(), "%s:%s:%s:%d", appID, auth.getDeviceId(), auth.getUserId(), 0);
|
||||
String signature = "";
|
||||
auth.setSignature(signature);
|
||||
}
|
||||
|
||||
private boolean refreshShareToken() {
|
||||
try {
|
||||
JSONObject body = new JSONObject();
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
c8bba231546a63b3431cf31e5d856794
|
||||
c427db3b8cae9cb6af9c809bcce62778
|
||||
|
|
|
|||
Loading…
Reference in New Issue