天意密码登录
This commit is contained in:
parent
1925fe1cc1
commit
047628c7bb
|
|
@ -81,21 +81,37 @@ public class TianYiHandler {
|
||||||
return cookieJar;
|
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();
|
cookieJar = new SimpleCookieJar();
|
||||||
cache = Cache.objectFrom(Path.read(getCache()));
|
cache = Cache.objectFrom(Path.read(getCache()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化
|
||||||
|
*/
|
||||||
|
public void init() {
|
||||||
String user = cache.getUser().getCookie();
|
String user = cache.getUser().getCookie();
|
||||||
if (StringUtils.isNoneBlank(user)) {
|
if (StringUtils.isNoneBlank(user)) {
|
||||||
JsonObject jsonObject = Json.safeObject(user);
|
JsonObject jsonObject = Json.safeObject(user);
|
||||||
String username = jsonObject.get("username").getAsString();
|
String username = jsonObject.get("username").getAsString();
|
||||||
String password = jsonObject.get("password").getAsString();
|
String password = jsonObject.get("password").getAsString();
|
||||||
|
if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
|
||||||
|
this.startFlow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.loginWithPassword(username, password);
|
this.loginWithPassword(username, password);
|
||||||
} else {
|
} else {
|
||||||
this.startFlow();
|
this.startFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanCookie() {
|
public void cleanCookie() {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@ public class TianyiApi {
|
||||||
private TianyiApi() {
|
private TianyiApi() {
|
||||||
Init.checkPermission();
|
Init.checkPermission();
|
||||||
|
|
||||||
tianYiHandler = new TianYiHandler();
|
tianYiHandler = TianYiHandler.get();
|
||||||
|
tianYiHandler.init();
|
||||||
cookieJar = tianYiHandler.getCookieJar();
|
cookieJar = tianYiHandler.getCookieJar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ public class Cache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveTianyiUser() {
|
public void saveTianyiUser() {
|
||||||
Init.execute(() -> Path.write(new TianYiHandler().getCache(), toString()));
|
Init.execute(() -> Path.write( TianYiHandler.get().getCache(), toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveTianyieUser() {
|
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();
|
qrCodeHandler.startUC_TOKENScan();
|
||||||
}
|
}
|
||||||
if (vodId.equals("天翼cookie")) {
|
if (vodId.equals("天翼cookie")) {
|
||||||
TianYiHandler qrCodeHandler = new TianYiHandler();
|
TianYiHandler qrCodeHandler = TianYiHandler.get();
|
||||||
qrCodeHandler.startScan();
|
qrCodeHandler.startFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vodId.equals("clean天翼cookie")) {
|
if (vodId.equals("clean天翼cookie")) {
|
||||||
TianYiHandler qrCodeHandler = new TianYiHandler();
|
TianYiHandler qrCodeHandler = TianYiHandler.get();
|
||||||
qrCodeHandler.cleanCookie();
|
qrCodeHandler.cleanCookie();
|
||||||
}
|
}
|
||||||
Vod item = new Vod();
|
Vod item = new Vod();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public class TianYiHandlerTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
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": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "电视直播",
|
"name": "电视直播",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue