天意密码登录
This commit is contained in:
parent
1925fe1cc1
commit
047628c7bb
|
|
@ -81,21 +81,37 @@ public class TianYiHandler {
|
|||
return cookieJar;
|
||||
}
|
||||
|
||||
public TianYiHandler() {
|
||||
private static class Loader {
|
||||
static volatile TianYiHandler INSTANCE = new TianYiHandler();
|
||||
}
|
||||
|
||||
public static TianYiHandler get() {
|
||||
return TianYiHandler.Loader.INSTANCE;
|
||||
}
|
||||
|
||||
private TianYiHandler() {
|
||||
|
||||
cookieJar = new SimpleCookieJar();
|
||||
cache = Cache.objectFrom(Path.read(getCache()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
public void init() {
|
||||
String user = cache.getUser().getCookie();
|
||||
if (StringUtils.isNoneBlank(user)) {
|
||||
JsonObject jsonObject = Json.safeObject(user);
|
||||
String username = jsonObject.get("username").getAsString();
|
||||
String password = jsonObject.get("password").getAsString();
|
||||
if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
|
||||
this.startFlow();
|
||||
return;
|
||||
}
|
||||
this.loginWithPassword(username, password);
|
||||
} else {
|
||||
this.startFlow();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void cleanCookie() {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ public class TianyiApi {
|
|||
private TianyiApi() {
|
||||
Init.checkPermission();
|
||||
|
||||
tianYiHandler = new TianYiHandler();
|
||||
tianYiHandler = TianYiHandler.get();
|
||||
tianYiHandler.init();
|
||||
cookieJar = tianYiHandler.getCookieJar();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ public class Cache {
|
|||
}
|
||||
|
||||
public void saveTianyiUser() {
|
||||
Init.execute(() -> Path.write(new TianYiHandler().getCache(), toString()));
|
||||
Init.execute(() -> Path.write( TianYiHandler.get().getCache(), toString()));
|
||||
}
|
||||
|
||||
public void saveTianyieUser() {
|
||||
Init.execute(() -> Path.write(new TianYiHandler().geteCache(), toString()));
|
||||
Init.execute(() -> Path.write( TianYiHandler.get().geteCache(), toString()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ public class Introduce extends Spider {
|
|||
qrCodeHandler.startUC_TOKENScan();
|
||||
}
|
||||
if (vodId.equals("天翼cookie")) {
|
||||
TianYiHandler qrCodeHandler = new TianYiHandler();
|
||||
qrCodeHandler.startScan();
|
||||
TianYiHandler qrCodeHandler = TianYiHandler.get();
|
||||
qrCodeHandler.startFlow();
|
||||
}
|
||||
|
||||
if (vodId.equals("clean天翼cookie")) {
|
||||
TianYiHandler qrCodeHandler = new TianYiHandler();
|
||||
TianYiHandler qrCodeHandler = TianYiHandler.get();
|
||||
qrCodeHandler.cleanCookie();
|
||||
}
|
||||
Vod item = new Vod();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class TianYiHandlerTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
tianYiHandler = new TianYiHandler();
|
||||
tianYiHandler = TianYiHandler.get();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
d06e5321a30e789d70ce9df6231d0518
|
||||
bb54c03fd035f011b948b4ccf1273819
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/refs/heads/tianyiPassword/jar/custom_spider.jar;md5;d06e5321a30e789d70ce9df6231d0518",
|
||||
"spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/refs/heads/tianyiPassword/jar/custom_spider.jar;md5;bb54c03fd035f011b948b4ccf1273819",
|
||||
"lives": [
|
||||
{
|
||||
"name": "电视直播",
|
||||
|
|
|
|||
Loading…
Reference in New Issue