This commit is contained in:
mshe 2026-06-08 17:31:58 +08:00
parent 2fd7792b7b
commit c6814b9765
2 changed files with 5 additions and 5 deletions

5
app.py
View File

@ -13,7 +13,7 @@ mcp = FastMCP("spider-server")
VNC_SERVER_HOST = "https://10.10.40.19:6080"
SHELL_DIR = "/home/dgs/vnc-server"
@mcp.tool()
async def mail_qq_spider(account: str,display: int) -> str:
async def mail_qq_spider(account: str,display: int) -> str:
"""qq邮箱爬虫,第一个参数是用户名
Args:
account: qq邮箱用户名
@ -23,8 +23,7 @@ async def mail_qq_spider(account: str,display: int) -> str:
"""
data={"display": display}
try:
os.environ['DISPLAY'] = f':{display}'
result = await asyncio.to_thread(start_mail_qq_spider, account)
result = await asyncio.to_thread(start_mail_qq_spider, account,display)
data["status"] = 200
data["result"] = result
return json.dumps(data, ensure_ascii=False)

View File

@ -111,7 +111,8 @@ def crawl_with_saved_state(auth_file):
browser.close()
def start(account):
def start(account, display=0):
os.environ['DISPLAY'] = f':{display}'
logging.info(f"用户名{account}")
if not account:
logging.error("请输入用户名")
@ -133,4 +134,4 @@ def start(account):
save_login_state(file_path, "收件箱")
if __name__ == '__main__':
start("123")
start("123",display=1)