From eb3452d5c45ce43b215666ff3e5aeef52f1fe24f Mon Sep 17 00:00:00 2001 From: Zhengyang Song Date: Thu, 2 Jan 2025 20:02:22 +0800 Subject: [PATCH] Use the pypi index version of browser_cookie3 in requirements.txt Also fix the issue mentioned in https://github.com/dataabc/weiboSpider/commit/914a03f08523e062c681d18b370cfaa0c33cecc4#r150866017 --- requirements.txt | 2 +- weibo_spider/config_util.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8530e875..11d01fc7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ lxml==4.9.1 requests==2.32.0 tqdm==4.66.3 absl-py==0.12.0 -git+https://github.com/borisbabic/browser_cookie3.git@refs/pull/215/head \ No newline at end of file +browser_cookie3==0.20.1 diff --git a/weibo_spider/config_util.py b/weibo_spider/config_util.py index 27f4eeb2..f5dc682d 100644 --- a/weibo_spider/config_util.py +++ b/weibo_spider/config_util.py @@ -207,7 +207,7 @@ def check_cookie(user_config_file_path): """Checks if user is logged in""" try: cookie = get_cookie() - if cookie["MLOGIN"] == '0': + if cookie.get("MLOGIN", '0') == '0': logger.warning("使用 Chrome 在此登录 %s", "https://passport.weibo.com/sso/signin?entry=wapsso&source=wapssowb&url=https://m.weibo.cn/") sys.exit() else: