增加延时应对反扒,修复字符匹配的边界问题

This commit is contained in:
wuitenye 2024-11-18 16:25:49 +08:00
parent 521aeeec33
commit bf710423d9
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import re
import time
from tqdm import tqdm
import util.LoginUtil as Login
import requests
@ -62,6 +63,7 @@ def get_message(start, count):
headers=headers,
timeout=(5, 10) # 设置连接超时为5秒读取超时为10秒
)
time.sleep(5)
except requests.Timeout:
print("请求超时")
return None

View File

@ -243,8 +243,8 @@ def get_content_from_split(content):
return content_split[1].strip() if len(content_split) > 1 else content.strip()
# 判断两个字符串是否存在互相包含的情况
# 判断两个字符串是否相等
def is_any_mutual_exist(str1, str2):
str1 = get_content_from_split(str1)
str2 = get_content_from_split(str2)
return str1 in str2 or str2 in str1
return str1 == str2