20250904-初步功能已完成

This commit is contained in:
2025-09-10 16:54:05 +08:00
parent e2e9e0b348
commit f6dda59c9f
5 changed files with 136 additions and 75 deletions

View File

@@ -58,6 +58,8 @@ class ControlUtils(object):
back = session.xpath(
"//*[@label='返回']"
" | "
"//*[@label='返回上一屏幕']"
" | "
"//XCUIElementTypeButton[@visible='true' and @name='TTKProfileNavBarBaseItemComponent' and @label='IconChevronLeftOffsetLTR']"
)
@@ -125,8 +127,9 @@ class ControlUtils(object):
videoCell = session.xpath(
'(//XCUIElementTypeCollectionView//XCUIElementTypeCell[.//XCUIElementTypeImage[@name="profile_video"]])[1]')
tab = session.xpath('//XCUIElementTypeButton[@name="TTKProfileTabVideoButton_0"]').get(timeout=2)
# 某些版本 tab.value 可能就是数量;或者 tab.label 类似 “作品 7”
tab = session.xpath(
'//XCUIElementTypeButton[@name="TTKProfileTabVideoButton_0" or contains(@label,"作品") or contains(@name,"作品")]'
).get(timeout=5) # 某些版本 tab.value 可能就是数量;或者 tab.label 类似 “作品 7”
m = re.search(r"\d+", tab.label)
num = 0

View File

@@ -11,15 +11,18 @@ class Requester():
@classmethod
def requestPrologue(cls, token):
headers = {
"vvtoken": token,
}
url = BaseUrl + cls.prologue
result = requests.get(headers=headers, url=url)
json = result.json()
data = json.get("data")
for i in data:
prologueList.append(i)
try:
headers = {
"vvtoken": token,
}
url = BaseUrl + cls.prologue
result = requests.get(headers=headers, url=url)
json = result.json()
data = json.get("data")
for i in data:
prologueList.append(i)
except Exception as e:
LogManager.method_error(f"获取requestPrologue失败,报错的原因:{e}", "获取requestPrologue异常")
# 翻译
@classmethod
@@ -29,20 +32,23 @@ class Requester():
"msg": msg,
"country": country,
}
url = "http://ai.zhukeping.com/translation"
url = "https://ai.yolozs.com/translation"
result = requests.request(url=url, json=parame, method="POST")
json = result.json()
data = json.get("data")
print(data)
return data
except Exception as e:
LogManager.method_error(f"翻译失败,报错的原因:{e}","翻译失败")
LogManager.method_error(f"翻译失败,报错的原因:{e}", "翻译失败异常")
# ai聊天
@classmethod
def chatToAi(cls, param):
url = "http://ai.zhukeping.com/chat"
result = requests.request(url=url, json=param, method="POST")
json = result.json()
data = json.get("data", {})
return data
try:
url = "https://ai.yolozs.com/chat"
result = requests.request(url=url, json=param, method="POST")
json = result.json()
data = json.get("data", {})
return data
except Exception as e:
LogManager.method_error(f"ai聊天失败,ai聊天出现异常,报错的原因:{e}", "ai聊天接口异常")