优化代码逻辑,优化依赖关联

This commit is contained in:
LibraHp_0928 2024-09-10 15:54:17 +08:00
parent dc16d9bc1a
commit e911920ca7
4 changed files with 15 additions and 3 deletions

View File

@ -40,7 +40,7 @@ if __name__ == '__main__':
message = Request.get_message(i * 100, 100).content.decode('utf-8')
html = Tools.process_old_html(message)
if "li" not in html:
break
continue
soup = BeautifulSoup(html, 'html.parser')
for element in soup.find_all('li', class_='f-single f-s-s'):
time = None

Binary file not shown.

View File

@ -0,0 +1 @@
{'skey': '@0LfHOPDPe', 'uin': 'o2108817943', 'p_skey': 'imlHEb63NeT1kfDnjxanOVSuH48x8dVSrk7YGXZNv1c_', 'p_uin': 'o2108817943', 'pt4_token': 'fQ0VtFhsEtRHeV7H*L4kwhKfPEmpvWw62fk4xMO3yPo_'}

View File

@ -52,8 +52,19 @@ def get_message(start, count):
g_tk,
],
}
response = requests.get('https://user.qzone.qq.com/proxy/domain/ic2.qzone.qq.com/cgi-bin/feeds/feeds2_html_pav_all',
params=params, cookies=cookies, headers=headers)
try:
response = requests.get(
'https://user.qzone.qq.com/proxy/domain/ic2.qzone.qq.com/cgi-bin/feeds/feeds2_html_pav_all',
params=params,
cookies=cookies,
headers=headers,
timeout=(5, 10) # 设置连接超时为5秒读取超时为10秒
)
except requests.Timeout:
print("请求超时")
return None
return response