Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix re match rule for check in result #40

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions zodgame/zodgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
import io
import re
import sys
import platform
import subprocess
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')

import undetected_chromedriver as uc
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
import requests

def zodgame_checkin(driver, formhash):
checkin_url = "https://zodgame.xyz/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&inajax=0"
Expand All @@ -28,11 +25,12 @@ def zodgame_checkin(driver, formhash):
checkin_query = checkin_query.replace("\n", "")
driver.set_script_timeout(240)
resp = driver.execute_script("return " + checkin_query)
match = re.search('<div class="c">\n(.*?)</div>\n', resp["response"], re.S)
match = re.search('<div class="c">\r\n(.*?)</div>\r\n', resp["response"], re.S)
message = match[1] if match is not None else "签到失败"
print(f"【签到】{message}")
return "恭喜你签到成功!" in message or "您今日已经签到,请明天再来" in message


def zodgame_task(driver, formhash):

def clear_handles(driver, main_handle):
Expand Down Expand Up @@ -118,7 +116,6 @@ def show_task_reward(driver):
def zodgame(cookie_string):
options = uc.ChromeOptions()
options.add_argument("--disable-popup-blocking")
options.add_argument("--headless")
driver = uc.Chrome(driver_executable_path = """C:\SeleniumWebDrivers\ChromeDriver\chromedriver.exe""",
browser_executable_path = """C:\Program Files\Google\Chrome\Application\chrome.exe""",
options = options)
Expand Down
Loading