mirror of
https://github.com/LibraHp/GetQzonehistory.git
synced 2025-02-22 21:29:06 +00:00
优化代码逻辑,优化依赖关联
This commit is contained in:
parent
dc16d9bc1a
commit
e911920ca7
2
main.py
2
main.py
@ -40,7 +40,7 @@ if __name__ == '__main__':
|
|||||||
message = Request.get_message(i * 100, 100).content.decode('utf-8')
|
message = Request.get_message(i * 100, 100).content.decode('utf-8')
|
||||||
html = Tools.process_old_html(message)
|
html = Tools.process_old_html(message)
|
||||||
if "li" not in html:
|
if "li" not in html:
|
||||||
break
|
continue
|
||||||
soup = BeautifulSoup(html, 'html.parser')
|
soup = BeautifulSoup(html, 'html.parser')
|
||||||
for element in soup.find_all('li', class_='f-single f-s-s'):
|
for element in soup.find_all('li', class_='f-single f-s-s'):
|
||||||
time = None
|
time = None
|
||||||
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
1
resource/user/o2108817943
Normal file
1
resource/user/o2108817943
Normal file
@ -0,0 +1 @@
|
|||||||
|
{'skey': '@0LfHOPDPe', 'uin': 'o2108817943', 'p_skey': 'imlHEb63NeT1kfDnjxanOVSuH48x8dVSrk7YGXZNv1c_', 'p_uin': 'o2108817943', 'pt4_token': 'fQ0VtFhsEtRHeV7H*L4kwhKfPEmpvWw62fk4xMO3yPo_'}
|
@ -52,8 +52,19 @@ def get_message(start, count):
|
|||||||
g_tk,
|
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
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user