From e911920ca76a5073969d8725c6a2ca953483f34f Mon Sep 17 00:00:00 2001 From: LibraHp_0928 <1941163264@qq.com> Date: Tue, 10 Sep 2024 15:54:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BE=9D=E8=B5=96=E5=85=B3?= =?UTF-8?q?=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- requirements.txt | Bin 954 -> 142 bytes resource/user/o2108817943 | 1 + util/RequestUtil.py | 15 +++++++++++++-- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 resource/user/o2108817943 diff --git a/main.py b/main.py index 619f011..db0c538 100644 --- a/main.py +++ b/main.py @@ -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 diff --git a/requirements.txt b/requirements.txt index 39b3da65f93abbd2fbdf1615971a25a0d322bfda..728e12936d4249b24b81c41b13ea548ddb10e0bc 100644 GIT binary patch literal 142 zcmW;DOAf;z3`Nm7i?PB-sXFi;x&=~PDH09FfLb!h+DjQeop(3#t?sWDOKR*89cTkq zu|I+@hz1NSs^;+i)4GCDLb*|?6RjTl*keo|M7_*2cP}#cNI|Q_ba4MhL<@TK+|SL+ Rg~Q;kvOH6u3vb|t{QwVNDlz~7 literal 954 zcmY+D(N4lZ6h!Z{iJt-i3aAgh`6CDgYHACmDDdE?t7q=*LP@h}(wRFmJG=e+UD&}k zR#;=Xt?iX3v!Ok)CiZ9#_RjZ(9j%44=3T?zDK+#z$pKXk~5Z(5~(i_ zXgtRpR%BKFH~Rpu;MI=KIy9Uj)d`o<)k+e{Z466mO6%;rzz2notNIxcc&jGbHmR}HaxW@ zM%sDoNzScpy~lz3v?Pjq5qaeJ+{+{WrOT2|dhEN=UE4F8leO*T&3YXkNPOzDs@pgv zb&>9$7`c71(tc;Ien7kIowCq$8=}n?#)`Iu#2t}(^r*~gv1NtsefA?AsmX#rBkLHN uO-(AHmioHDQL8`jlt8ET;^>~Qx|1u?3)TM?e}ZOLy*oG{>pfRWnf(K(xrht^ diff --git a/resource/user/o2108817943 b/resource/user/o2108817943 new file mode 100644 index 0000000..8d53fa3 --- /dev/null +++ b/resource/user/o2108817943 @@ -0,0 +1 @@ +{'skey': '@0LfHOPDPe', 'uin': 'o2108817943', 'p_skey': 'imlHEb63NeT1kfDnjxanOVSuH48x8dVSrk7YGXZNv1c_', 'p_uin': 'o2108817943', 'pt4_token': 'fQ0VtFhsEtRHeV7H*L4kwhKfPEmpvWw62fk4xMO3yPo_'} \ No newline at end of file diff --git a/util/RequestUtil.py b/util/RequestUtil.py index 332e11a..eadebfc 100644 --- a/util/RequestUtil.py +++ b/util/RequestUtil.py @@ -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