新增手动签到
新增百合会签到 优化天使动漫签到 优化大头菜统计最高价日 修复大头菜第二周数据未清空 新增大头菜显示购入价功能
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
package com.yutou.qqbot.models.WebSign;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.qqbot.QQBotManager;
|
||||
import com.yutou.qqbot.models.Model;
|
||||
import com.yutou.qqbot.utlis.AppTools;
|
||||
import com.yutou.qqbot.utlis.ConfigTools;
|
||||
import com.yutou.qqbot.utlis.StringUtils;
|
||||
import com.yutou.qqbot.utlis.WebClient;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Cookie;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class BaiHeHui extends Model {
|
||||
@Override
|
||||
@@ -25,19 +29,27 @@ public class BaiHeHui extends Model {
|
||||
@Override
|
||||
public void onTime(String time) {
|
||||
super.onTime(time);
|
||||
if("08:00".equals(time)){
|
||||
sign();
|
||||
if ("08:00".equals(time)) {
|
||||
try {
|
||||
sign();
|
||||
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup,"百合会签到成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup,"百合会签到失败:"+ AppTools.getExceptionString(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sign(){
|
||||
String cookie= ConfigTools.readFile(new File("baihehui.json"));
|
||||
if(StringUtils.isEmpty(cookie)){
|
||||
public 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");
|
||||
WebDriver driver = WebClient.getInstance().getWebDriver();
|
||||
JSONArray array = JSONArray.parseArray(cookie);
|
||||
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
|
||||
driver.get("https://bbs.yamibo.com/forum.php");
|
||||
driver.manage().deleteAllCookies();
|
||||
for (Cookie _cookie : WebClient.loadCookie(array)) {
|
||||
driver.manage().addCookie(_cookie);
|
||||
}
|
||||
@@ -47,10 +59,17 @@ public class BaiHeHui extends Model {
|
||||
e.printStackTrace();
|
||||
}
|
||||
driver.navigate().refresh();
|
||||
|
||||
for (WebElement element : driver.findElements(By.xpath("//a"))) {
|
||||
if("打卡签到".equals(element.getText())){
|
||||
element.click();
|
||||
return;
|
||||
}
|
||||
}
|
||||
driver.close();
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BaiHeHui().sign();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,16 @@ package com.yutou.qqbot.models.WebSign;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yutou.qqbot.QQBotManager;
|
||||
import com.yutou.qqbot.models.Model;
|
||||
import com.yutou.qqbot.utlis.AppTools;
|
||||
import com.yutou.qqbot.utlis.ConfigTools;
|
||||
import com.yutou.qqbot.utlis.StringUtils;
|
||||
import com.yutou.qqbot.utlis.WebClient;
|
||||
import net.mamoe.mirai.event.events.MessageEvent;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Cookie;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.yutou.qqbot.utlis.WebClient.getOptions;
|
||||
|
||||
public class Tsdm extends Model {
|
||||
@Override
|
||||
public boolean isUserPublic() {
|
||||
@@ -34,53 +29,74 @@ public class Tsdm extends Model {
|
||||
@Override
|
||||
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
|
||||
super.onMessage(qq, event, isGroup);
|
||||
if(msg.startsWith(QQFromCommands.TSDM_PAY)){
|
||||
String url=msg.replace(QQFromCommands.TSDM_PAY,"").trim();
|
||||
if(StringUtils.isEmpty(url)){
|
||||
QQBotManager.getInstance().sendMessage(qq,"使用说明:!tsdm [url]");
|
||||
if (msg.startsWith(QQFromCommands.TSDM_PAY)) {
|
||||
String url = msg.replace(QQFromCommands.TSDM_PAY, "").trim();
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
QQBotManager.getInstance().sendMessage(qq, "使用说明:!tsdm [url]");
|
||||
return;
|
||||
}
|
||||
QQBotManager.getInstance().sendMessage(qq,"正在获取,请稍等...");
|
||||
QQBotManager.getInstance().sendMessage(qq,tsdm(url));
|
||||
QQBotManager.getInstance().sendMessage(qq, "正在获取,请稍等...");
|
||||
QQBotManager.getInstance().sendMessage(qq, tsdm(url));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTime(String time) {
|
||||
super.onTime(time);
|
||||
if("08:00".equals(time)){
|
||||
tsdmSign();
|
||||
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup,"已完成天使动漫的签到");
|
||||
if ("08:00".equals(time)) {
|
||||
try {
|
||||
tsdmSign();
|
||||
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup, "已完成天使动漫的签到");
|
||||
} catch (Exception e) {
|
||||
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup, "天使动漫签到失败:" + AppTools.getExceptionString(e));
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void tsdmSign(){
|
||||
public void tsdmSign() {
|
||||
JSONArray array = JSONArray.parseArray(ConfigTools.readFile(new File("cookie.json")));
|
||||
if (array == null) {
|
||||
System.err.println("array is null");
|
||||
return;
|
||||
}
|
||||
WebDriver driver =WebClient.getInstance().getWebDriver();
|
||||
WebDriver driver = WebClient.getInstance().getWebDriver();
|
||||
driver.get("https://www.tsdm39.net/forum.php");
|
||||
getTsdm(array, driver);
|
||||
boolean isSign=false;
|
||||
for (WebElement element : driver.findElements(By.xpath("//a"))) {
|
||||
if(element.getText().contains("签到")){
|
||||
isSign=true;
|
||||
}
|
||||
}
|
||||
if(!isSign){
|
||||
driver.close();
|
||||
driver.quit();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
((JavascriptExecutor) driver).executeScript("showWindow('dsu_paulsign', 'plugin.php?id=dsu_paulsign:sign&9b5e8da2')");
|
||||
}catch (Exception ignored){
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
driver.findElement(By.id("wl")).click();
|
||||
driver.findElement(By.xpath("//input[@value='3']")).click();
|
||||
driver.findElement(By.id("qiandao")).submit();
|
||||
try {
|
||||
driver.findElement(By.id("wl")).click();
|
||||
driver.findElement(By.xpath("//input[@value='3']")).click();
|
||||
driver.findElement(By.id("qiandao")).submit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
driver.close();
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
private void getTsdm(JSONArray array, WebDriver driver) {
|
||||
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
|
||||
driver.manage().deleteAllCookies();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -103,7 +119,7 @@ public class Tsdm extends Model {
|
||||
System.err.println("array is null");
|
||||
return null;
|
||||
}
|
||||
WebDriver driver =WebClient.getInstance().getWebDriver();
|
||||
WebDriver driver = WebClient.getInstance().getWebDriver();
|
||||
driver.get(url);
|
||||
getTsdm(array, driver);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user