|
@@ -1,3 +1,4 @@
|
|
|
|
|
+import os
|
|
|
from playwright.sync_api import sync_playwright
|
|
from playwright.sync_api import sync_playwright
|
|
|
import time
|
|
import time
|
|
|
|
|
|
|
@@ -14,40 +15,38 @@ def get_wallet_detail(wallet_address: str, page):
|
|
|
# 填入钱包地址
|
|
# 填入钱包地址
|
|
|
page.fill(input_selector, wallet_address)
|
|
page.fill(input_selector, wallet_address)
|
|
|
|
|
|
|
|
- # 等待按钮出现并确保其可点击
|
|
|
|
|
|
|
+ # 等待按钮出现并尝试点击,捕获异常以忽略找不到按钮的情况
|
|
|
page.wait_for_selector(button_selector, state='visible', timeout=10000)
|
|
page.wait_for_selector(button_selector, state='visible', timeout=10000)
|
|
|
- # 点击按钮
|
|
|
|
|
- page.click(button_selector)
|
|
|
|
|
|
|
+ try:
|
|
|
|
|
+ page.click(button_selector)
|
|
|
|
|
+ print(f"已成功点击按钮,查询钱包地址:{wallet_address}")
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"未找到按钮,跳过点击操作。钱包地址:{wallet_address}")
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
print(f"查询钱包 {wallet_address} 时出错: {str(e)}")
|
|
print(f"查询钱包 {wallet_address} 时出错: {str(e)}")
|
|
|
|
|
|
|
|
def run():
|
|
def run():
|
|
|
with sync_playwright() as p:
|
|
with sync_playwright() as p:
|
|
|
- # 启动一个 Chromium 浏览器,headless=False 确保可见
|
|
|
|
|
browser = p.chromium.launch(
|
|
browser = p.chromium.launch(
|
|
|
- headless=False,
|
|
|
|
|
|
|
+ headless=True,
|
|
|
args=["--start-maximized"]
|
|
args=["--start-maximized"]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- wallet_list = [
|
|
|
|
|
- '0xe50B77Cd771243b8Ae1d6ce33b4E13ECC5Fa28a6',
|
|
|
|
|
- '0x9ea2ECAD4090E32916e03b77d7C75CbF6C8E0A55',
|
|
|
|
|
- '0xE8A4b0C04300154DC9B1D0e565Ba70F996614690',
|
|
|
|
|
- '0x1b623c5d70c93b437d93c305bf2cfa389095f636',
|
|
|
|
|
- '0x06D25c3e0E1F753ac0486a3f8aaD7259149656cB',
|
|
|
|
|
- '0x15cFEE34Ca4541CAc9a1c4B6F6aB47A65877E240',
|
|
|
|
|
- '0x7aBF0dA8Ac07B6dE7206e467988455E1AD0b60B5',
|
|
|
|
|
- '0xF736f45d4663a8D8DfF7EFA55b1Cf6Fe38D026c8',
|
|
|
|
|
- '0x83173eECf3a6d9ABB79682568e16c2eAd361620e',
|
|
|
|
|
- '0xa401b85B4849Fc7610Bd180cc937859C78528F47'
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ wallet_list = []
|
|
|
|
|
+ wallet_txt_path = os.path.join(os.getcwd(), "wallet.txt")
|
|
|
|
|
+ with open(wallet_txt_path, "r") as file:
|
|
|
|
|
+ wallet_list = [line.strip() for line in file]
|
|
|
|
|
|
|
|
|
|
+ if len(wallet_list) == 0:
|
|
|
|
|
+ print("未找到钱包地址")
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
context = browser.new_context(no_viewport=True)
|
|
context = browser.new_context(no_viewport=True)
|
|
|
|
|
|
|
|
- for i, wallet in enumerate(wallet_list):
|
|
|
|
|
|
|
+ for i, wallet in enumerate(wallet_list, 1):
|
|
|
page = context.new_page()
|
|
page = context.new_page()
|
|
|
page.goto("https://repute.monadscore.xyz/")
|
|
page.goto("https://repute.monadscore.xyz/")
|
|
|
- print(f"已打开第 {i + 1} 个标签页")
|
|
|
|
|
|
|
+ print(f"已打开第 {i} 个标签页")
|
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
print(f'正在查询钱包 {i} : {wallet}')
|
|
print(f'正在查询钱包 {i} : {wallet}')
|
|
|
get_wallet_detail(wallet, page)
|
|
get_wallet_detail(wallet, page)
|