Merge pull request #286 from ziZai771/patch-1
Some checks failed
Build and Release / build-macos-aarch64 (push) Has been cancelled
Build and Release / build-macos-x86_64 (push) Has been cancelled
Build and Release / build-windows (push) Has been cancelled
Build and Release / release (push) Has been cancelled

获取内容时,添加随机延时策略,修正获取失败问题
This commit is contained in:
冰晓焰 2024-12-19 21:35:37 +08:00 committed by GitHub
commit 4fbd32089d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,7 @@ import traceback
import dateparser
import hashlib
import copy
import random
# 程序版本
version = "1.0.2"
@ -1105,7 +1106,7 @@ def main(page: ft.Page):
if is_stop:
return 0
response = get_message(total, 10)
time.sleep(1)
time.sleep(random.uniform(5, 10))
if "img" in response.text:
# 请求成功,总量应该在当前总量的右侧
lower_bound = total + 1
@ -1150,7 +1151,7 @@ def main(page: ft.Page):
break
try:
# 获取消息并解码
time.sleep(1)
time.sleep(random.uniform(5, 10))
message_content = get_message(i * 100, 100).text
message = message_content if message_content else None
if not message: