20250918-新增主播库功能

This commit is contained in:
2025-09-18 20:15:07 +08:00
parent 2fe1576eaa
commit 11e72d0fae
6 changed files with 327 additions and 63 deletions

View File

@@ -61,10 +61,6 @@ class ScriptManager():
session.appium_settings({"snapshotMaxDepth": 15})
# 判断当前页面上是否有推荐按钮
# el = session(xpath='//XCUIElementTypeButton[@name="top_tabs_recomend"]')
# node = session.xpath(
# '//XCUIElementTypeButton[@name="top_tabs_recomend" or @name="推荐" or @label="推荐"]'
# )
el = session.xpath(
'//XCUIElementTypeButton[@name="top_tabs_recomend" or @name="推荐" or @label="推荐"]'
@@ -278,10 +274,7 @@ class ScriptManager():
retries = 0
while not event.is_set():
try:
# AiUtils.pop_aclist_first()
# anchor = AiUtils.pop_aclist_first()
# if not anchor:
# break
self.greetNewFollowers(udid, needReply, event)
except Exception as e:
@@ -301,11 +294,13 @@ class ScriptManager():
LogManager.method_info(f"是否要自动回复消息:{needReply}", "关注打招呼", udid)
# 先关闭Tik Tok
ControlUtils.closeTikTok(session, udid)
time.sleep(1)
# 重新打开Tik Tok
ControlUtils.openTikTok(session, udid)
time.sleep(3)
LogManager.method_info(f"重启tiktok", "关注打招呼", udid)
# 设置查找深度
@@ -369,7 +364,6 @@ class ScriptManager():
input.set_text(f"{aid or '暂无数据'}\n")
# 定位 "关注" 按钮 通过关注按钮的位置点击主播首页
session.appium_settings({"snapshotMaxDepth": 25})
try:
@@ -499,10 +493,9 @@ class ScriptManager():
chatInput = session.xpath("//TextView")
if chatInput.exists:
chatInput.click()
chatInput.set_text(f"{msg or '暂无数据'}\n")
time.sleep(2)
# 发送消息
chatInput.set_text(f"{msg or '暂无数据'}\n")
# input.set_text(f"{aid or '暂无数据'}\n")
time.sleep(1)
@@ -603,6 +596,7 @@ class ScriptManager():
time.sleep(3)
continue # 重新进入 while 循环,调用 monitorMessages
# 检查未读消息并回复
def monitorMessages(self, session, udid):