20250904-初步功能已完成
This commit is contained in:
@@ -301,12 +301,12 @@ class ScriptManager():
|
||||
LogManager.method_info(f"是否要自动回复消息:{needReply}", "关注打招呼", udid)
|
||||
|
||||
# 先关闭Tik Tok
|
||||
# ControlUtils.closeTikTok(session, udid)
|
||||
# time.sleep(random.uniform(1.5, 2.5))
|
||||
#
|
||||
# # 重新打开Tik Tok
|
||||
# ControlUtils.openTikTok(session, udid)
|
||||
# time.sleep(random.uniform(2.5, 3.5))
|
||||
ControlUtils.closeTikTok(session, udid)
|
||||
time.sleep(1)
|
||||
|
||||
# 重新打开Tik Tok
|
||||
ControlUtils.openTikTok(session, udid)
|
||||
time.sleep(3)
|
||||
|
||||
# 设置查找深度
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
@@ -319,7 +319,7 @@ class ScriptManager():
|
||||
for i in range(count):
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
ControlUtils.clickBack(session)
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
time.sleep(2)
|
||||
|
||||
LogManager.method_info(f"循环条件1:{not event.is_set()}", "关注打招呼", udid)
|
||||
LogManager.method_info(f"循环条件2:{len(anchorList) > 0}", "关注打招呼", udid)
|
||||
@@ -332,7 +332,7 @@ class ScriptManager():
|
||||
anchor = AiUtils.pop_aclist_first()
|
||||
if not anchor:
|
||||
LogManager.method_info(f"数据库中的数据不足", "关注打招呼", udid)
|
||||
time.sleep(random.uniform(25, 35))
|
||||
time.sleep(30)
|
||||
continue
|
||||
|
||||
aid = anchor["anchorId"]
|
||||
@@ -341,8 +341,6 @@ class ScriptManager():
|
||||
# 点击搜索按钮
|
||||
ControlUtils.clickSearch(session)
|
||||
|
||||
|
||||
|
||||
# 强制刷新session
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
|
||||
@@ -358,7 +356,7 @@ class ScriptManager():
|
||||
print(f"找不到输入框")
|
||||
|
||||
input.clear_text()
|
||||
time.sleep(random.uniform(1, 2))
|
||||
time.sleep(1)
|
||||
# 输入主播id
|
||||
input.set_text(f"{aid or '暂无数据'}\n")
|
||||
|
||||
@@ -378,11 +376,11 @@ class ScriptManager():
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
continue
|
||||
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
time.sleep(2)
|
||||
|
||||
# 找到并点击第一个视频
|
||||
cellClickResult, workCount = ControlUtils.clickFirstVideoFromDetailPage(session)
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
time.sleep(2)
|
||||
|
||||
# 观看主播视频
|
||||
def viewAnchorVideo(workCount):
|
||||
@@ -395,11 +393,11 @@ class ScriptManager():
|
||||
count = workCount
|
||||
|
||||
while count != 0:
|
||||
time.sleep(random.uniform(3, 6))
|
||||
time.sleep(5)
|
||||
img = client.screenshot()
|
||||
time.sleep(random.uniform(0.5, 2))
|
||||
# filePath = f"resources/{udid}/bgv.png"
|
||||
time.sleep(1)
|
||||
|
||||
# filePath = f"resources/{udid}/bgv.png"
|
||||
|
||||
base_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) # 当前脚本目录的上一级
|
||||
filePath = os.path.join(base_dir, "resources", udid, "bgv.png")
|
||||
@@ -410,7 +408,7 @@ class ScriptManager():
|
||||
img.save(filePath)
|
||||
|
||||
LogManager.method_info("保存屏幕图像成功", "关注打招呼", udid)
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
time.sleep(2)
|
||||
# 查找add图标
|
||||
r = ControlUtils.clickLike(session, udid)
|
||||
|
||||
@@ -467,8 +465,8 @@ class ScriptManager():
|
||||
LogManager.method_info(f"传递的打招呼的数据:{ev.prologueList}", "关注打招呼", udid)
|
||||
|
||||
# 准备打招呼的文案
|
||||
text = random.choice(ev.prologueList)
|
||||
# text = 'hello'
|
||||
# text = random.choice(ev.prologueList)
|
||||
text = 'hello'
|
||||
|
||||
LogManager.method_info(f"取出打招呼的数据,{text}, 判断是否需要翻译", "关注打招呼", udid)
|
||||
|
||||
@@ -487,13 +485,13 @@ class ScriptManager():
|
||||
|
||||
# 准备发送一条信息
|
||||
chatInput.click()
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
time.sleep(2)
|
||||
# 发送消息
|
||||
chatInput.set_text(f"{msg or '暂无数据'}\n")
|
||||
|
||||
# input.set_text(f"{aid or '暂无数据'}\n")
|
||||
|
||||
time.sleep(random.uniform(1, 2))
|
||||
time.sleep(1)
|
||||
|
||||
else:
|
||||
print("无法发送信息")
|
||||
@@ -503,28 +501,11 @@ class ScriptManager():
|
||||
# removeModelFromAnchorList(anchor)
|
||||
goBack(1)
|
||||
|
||||
session.appium_settings({"snapshotMaxDepth": 25})
|
||||
# 点击关注按钮
|
||||
followButton = AiUtils.getFollowButton(session)
|
||||
if followButton:
|
||||
|
||||
|
||||
if followButton is not None:
|
||||
LogManager.method_info("找到关注按钮了", "关注打招呼", udid)
|
||||
x, y, w, h = followButton.bounds
|
||||
# 基础中心
|
||||
cx = int(x + w / 2)
|
||||
cy = int(y + h / 2)
|
||||
# 随机偏移 ±5 px(可自己改范围)
|
||||
cx += random.randint(-5, 5)
|
||||
cy += random.randint(-5, 5)
|
||||
session.tap(cx - 95 + random.randint(-5, 5), cy)
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
# session.tap(cx - 50, cy - 50)
|
||||
|
||||
LogManager.method_info(f"关注按钮落点=({cx},{cy})", "关注打招呼", udid)
|
||||
session.tap(cx, cy) # facebook-wda 需要列表传参
|
||||
time.sleep(random.uniform(1.5, 2.5))
|
||||
|
||||
followButton.click()
|
||||
else:
|
||||
LogManager.method_info("没找到关注按钮", "关注打招呼", udid)
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user