57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package com.yutou.qqbot.models.WebSign;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yutou.qqbot.models.Model;
|
|
import com.yutou.qqbot.utlis.ConfigTools;
|
|
import com.yutou.qqbot.utlis.StringUtils;
|
|
import com.yutou.qqbot.utlis.WebClient;
|
|
import org.openqa.selenium.Cookie;
|
|
import org.openqa.selenium.WebDriver;
|
|
|
|
import java.io.File;
|
|
|
|
public class BaiHeHui extends Model {
|
|
@Override
|
|
public boolean isUserPublic() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String[] getUsePowers() {
|
|
return new String[0];
|
|
}
|
|
|
|
@Override
|
|
public void onTime(String time) {
|
|
super.onTime(time);
|
|
if("08:00".equals(time)){
|
|
sign();
|
|
}
|
|
}
|
|
|
|
private void sign(){
|
|
String cookie= ConfigTools.readFile(new File("baihehui.json"));
|
|
if(StringUtils.isEmpty(cookie)){
|
|
return;
|
|
}
|
|
WebDriver driver=WebClient.getInstance().getWebDriver();
|
|
JSONArray array=JSONArray.parseArray(cookie);
|
|
driver.get("https://bbs.yamibo.com/plugin.php?id=study_daily_attendance:daily_attendance&fhash=425430f7");
|
|
for (Cookie _cookie : WebClient.loadCookie(array)) {
|
|
driver.manage().addCookie(_cookie);
|
|
}
|
|
try {
|
|
Thread.sleep(500);
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
}
|
|
driver.navigate().refresh();
|
|
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
new BaiHeHui().sign();
|
|
}
|
|
}
|