From 3806e7ff076d203b7667066fb5b1e4142ce7764d Mon Sep 17 00:00:00 2001 From: 4Aiur <14359997+4Aiur@users.noreply.github.com> Date: Sun, 15 Sep 2024 10:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9C=80=E8=A6=81=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fetch_all_message.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fetch_all_message.py b/fetch_all_message.py index 4e50829..6efe267 100644 --- a/fetch_all_message.py +++ b/fetch_all_message.py @@ -12,9 +12,12 @@ from util import LoginUtil WORKDIR = "./resource/fetch-all/" MESSAGE_SAMPLE = 'msg-one.json' MESSAGE_ALL = 'msg-all.json' - +cookies = None # 获取所有可见的未删除的说说+高清图片(包含2014年之前) def get_visible_msg_list(): + global cookies + if cookies is None: + cookies = LoginUtil.cookie() # 1. 获取说说总条数 try: msgSample = read_txt_file(MESSAGE_SAMPLE) @@ -49,7 +52,7 @@ def get_visible_msg_list(): # 数据偏移量 pos = currentPageNum * defaultPageSize print( - f"=========一页{defaultPageSize}条, 获取第{currentPageNum + 1}页, 需要再次选择账号(再次输入1即可)=========") + f"一页{defaultPageSize}条, 获取第{currentPageNum + 1}页") qqResponse = get_msg_list(defaultPageSize, pos) currentPageData = json.loads(qqResponse)["msglist"] allPageData.extend(currentPageData) @@ -111,7 +114,6 @@ def get_visible_msg_list(): def get_msg_list(pageSize, offset=0): url = 'https://user.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/emotion_cgi_msglist_v6' - cookies = LoginUtil.cookie() g_tk = LoginUtil.bkn(cookies.get('p_skey')) qqNumber = re.sub(r'o0*', '', cookies.get('uin')) skey = cookies.get('skey')