first commit
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import os
|
||||
from playwright.sync_api import sync_playwright
|
||||
from screeninfo import get_monitors
|
||||
|
||||
def get_wallet_detail(wallet_address: str, page):
|
||||
# 定义输入框和按钮的选择器
|
||||
input_selector = '#root > div > div > div.min-h-screen.overflow-hidden.sm\\:ml-0 > div:nth-child(3) > div > div > div.flex.flex-col.space-y-4 > input'
|
||||
button_selector = '#root > div > div > div.min-h-screen.overflow-hidden.sm\\:ml-0 > div:nth-child(3) > div > div > div.flex.flex-col.space-y-4 > button.px-4.py-2.text-white.font-semibold.rounded-md.bg-purple-600.cursor-pointer.hover\\:bg-purple-700'
|
||||
|
||||
try:
|
||||
# 等待输入框出现并确保其可交互
|
||||
page.wait_for_selector(input_selector, state='visible', timeout=10000)
|
||||
# 清除输入框内容(如果有默认值)
|
||||
page.fill(input_selector, '')
|
||||
# 填入钱包地址
|
||||
page.fill(input_selector, wallet_address)
|
||||
|
||||
# 等待按钮出现并尝试点击,捕获异常以忽略找不到按钮的情况
|
||||
page.wait_for_selector(button_selector, state='visible', timeout=10000)
|
||||
try:
|
||||
page.click(button_selector)
|
||||
print(f"已成功点击按钮,查询钱包地址:{wallet_address}")
|
||||
except Exception as e:
|
||||
print(f"未找到按钮,跳过点击操作。钱包地址:{wallet_address}")
|
||||
except Exception as e:
|
||||
print(f"查询钱包 {wallet_address} 时出错: {str(e)}")
|
||||
|
||||
def main():
|
||||
# 读取钱包地址
|
||||
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
|
||||
|
||||
if len(wallet_list) > 10:
|
||||
print("钱包地址数量超过10个,仅处理前10个。")
|
||||
wallet_list = wallet_list[:10]
|
||||
|
||||
# 获取屏幕大小
|
||||
monitors = get_monitors()
|
||||
screen_width = monitors[0].width
|
||||
screen_height = monitors[0].height
|
||||
|
||||
# 每个窗口的大小
|
||||
window_width = screen_width // 5
|
||||
window_height = screen_height // 2
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(headless=False, args=["--start-maximized"])
|
||||
|
||||
for i, wallet in enumerate(wallet_list):
|
||||
# 计算窗口位置
|
||||
row = i // 5
|
||||
col = i % 5
|
||||
x = col * window_width
|
||||
y = row * window_height
|
||||
|
||||
# 创建新页面并设置窗口位置
|
||||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
page.set_viewport_size({'width': window_width, 'height': window_height})
|
||||
page.context.set_window_position(x, y)
|
||||
page.goto("https://repute.monadscore.xyz/")
|
||||
print(f"已打开浏览器实例,查询钱包地址:{wallet}")
|
||||
get_wallet_detail(wallet, page)
|
||||
|
||||
print("所有浏览器已打开,可以手动操作。")
|
||||
input("按任意键退出程序...")
|
||||
|
||||
# 关闭浏览器
|
||||
browser.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,66 @@
|
||||
import os
|
||||
from playwright.sync_api import sync_playwright
|
||||
import time
|
||||
|
||||
def get_wallet_detail(wallet_address: str, page):
|
||||
# 定义输入框和按钮的选择器
|
||||
input_selector = '#root > div > div > div.min-h-screen.overflow-hidden.sm\\:ml-0 > div:nth-child(3) > div > div > div.flex.flex-col.space-y-4 > input'
|
||||
button_selector = '#root > div > div > div.min-h-screen.overflow-hidden.sm\\:ml-0 > div:nth-child(3) > div > div > div.flex.flex-col.space-y-4 > button.px-4.py-2.text-white.font-semibold.rounded-md.bg-purple-600.cursor-pointer.hover\\:bg-purple-700'
|
||||
|
||||
try:
|
||||
# 等待输入框出现并确保其可交互
|
||||
page.wait_for_selector(input_selector, state='visible', timeout=10000)
|
||||
# 清除输入框内容(如果有默认值)
|
||||
page.fill(input_selector, '')
|
||||
# 填入钱包地址
|
||||
page.fill(input_selector, wallet_address)
|
||||
|
||||
# 等待按钮出现并尝试点击,捕获异常以忽略找不到按钮的情况
|
||||
page.wait_for_selector(button_selector, state='visible', timeout=10000)
|
||||
try:
|
||||
page.click(button_selector)
|
||||
print(f"已成功点击按钮,查询钱包地址:{wallet_address}")
|
||||
except Exception as e:
|
||||
print(f"未找到按钮,跳过点击操作。钱包地址:{wallet_address}")
|
||||
except Exception as e:
|
||||
print(f"查询钱包 {wallet_address} 时出错: {str(e)}")
|
||||
|
||||
def run():
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(
|
||||
headless=True,
|
||||
args=["--start-maximized"]
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
for i, wallet in enumerate(wallet_list, 1):
|
||||
page = context.new_page()
|
||||
page.goto("https://repute.monadscore.xyz/")
|
||||
print(f"已打开第 {i} 个标签页")
|
||||
time.sleep(1)
|
||||
print(f'正在查询钱包 {i} : {wallet}')
|
||||
get_wallet_detail(wallet, page)
|
||||
|
||||
time.sleep(3600)
|
||||
|
||||
context.close()
|
||||
browser.close()
|
||||
|
||||
|
||||
def main():
|
||||
while True:
|
||||
run()
|
||||
time.sleep(5)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,10 @@
|
||||
0xe50B77Cd771243b8Ae1d6ce33b4E13ECC5Fa28a6
|
||||
0x9ea2ECAD4090E32916e03b77d7C75CbF6C8E0A55
|
||||
0xE8A4b0C04300154DC9B1D0e565Ba70F996614690
|
||||
0x1b623c5d70c93b437d93c305bf2cfa389095f636
|
||||
0x06D25c3e0E1F753ac0486a3f8aaD7259149656cB
|
||||
0x15cFEE34Ca4541CAc9a1c4B6F6aB47A65877E240
|
||||
0x7aBF0dA8Ac07B6dE7206e467988455E1AD0b60B5
|
||||
0xF736f45d4663a8D8DfF7EFA55b1Cf6Fe38D026c8
|
||||
0x83173eECf3a6d9ABB79682568e16c2eAd361620e
|
||||
0xa401b85B4849Fc7610Bd180cc937859C78528F47
|
||||
Reference in New Issue
Block a user