合并代码

This commit is contained in:
2025-09-17 15:48:41 +08:00
8 changed files with 77 additions and 33 deletions

View File

@@ -406,6 +406,7 @@ class AiUtils(object):
'分享发布内容', '视频贴纸标签页', '双击发送表情', '贴纸',
}
SYSTEM_PATTERNS = [
r"(消息请求已被接受|你开始了和.*的聊天|你打开了这个与.*的聊天).*"
r"回复时接收通知", r"开启(私信)?通知", r"开启通知",
r"你打开了这个与 .* 的聊天。.*隐私",
r"在此用户接受你的消息请求之前,你最多只能发送 ?\d+ 条消息。?",

View File

@@ -150,6 +150,8 @@ class ControlUtils(object):
print("没有找到主页的第一个视频")
return False, num
@classmethod
def clickFollow(cls, session, aid):
# 1) 含“关注/已关注/Follow/Following”的首个 cell
@@ -177,6 +179,33 @@ class ControlUtils(object):
left_x = max(1, rect.x - 20)
center_y = rect.y + rect.height // 2
session.tap(left_x, center_y)
@classmethod
def userClickProfile(cls, session, aid):
try:
user_btn = session.xpath("(//XCUIElementTypeButton[@name='用户' and @visible='true'])[1]")
if user_btn:
user_btn.click()
time.sleep(3)
follow_btn = session.xpath(
"(//XCUIElementTypeTable//XCUIElementTypeButton[@name='关注' or @name='已关注'])[1]"
).get(timeout=5)
if follow_btn:
x, y, w, h = follow_btn.bounds
# 垂直方向中心 + 随机 3~8 像素偏移
cy = int(y + h / 2 + random.randint(-8, 8))
# 横向往左偏移 80~120 像素之间的随机值
cx = int(x - random.randint(80, 120))
# 点击
session.tap(cx, cy)
return True
return False
except Exception as e:
print(e)
return False
# 随机滑动一点点距离

View File

@@ -17,7 +17,7 @@ class Requester():
"vvtoken": token,
}
url = BaseUrl + cls.prologue
result = requests.get(headers=headers, url=url)
result = requests.get(headers=headers, url=url, verify=False)
json = result.json()
data = json.get("data")
for i in data:
@@ -29,14 +29,18 @@ class Requester():
@classmethod
def translation(cls, msg, country="英国"):
try:
if country == "":
country = "英国"
param = {
"msg": msg,
"country": country,
}
url = "https://ai.yolozs.com/translation"
result = requests.post(url=url, json=param)
result = requests.post(url=url, json=param, verify=False)
LogManager.info(f"翻译,状态码:{result.status_code},服务器返回的内容:{result.text}")
LogManager.info(f"翻译 请求的参数:{param}", "翻译")
LogManager.info(f"翻译,状态码:{result.status_code},服务器返回的内容:{result.text}", "翻译")
if result.status_code != 200:
LogManager.error(f"翻译失败,状态码:{result.status_code},服务器返回的内容:{result.text}")
@@ -66,11 +70,9 @@ class Requester():
param["inputs"] = inputs
print(param)
try:
url = "https://ai.yolozs.com/chat"
result = requests.post(url=url, json=param)
result = requests.post(url=url, json=param, verify=False)
json = result.json()
data = json.get("answer", {})
session_id = json.get("conversation_id", {})