wangkun 2 years ago
parent
commit
de34d4e7ae
3 changed files with 12 additions and 10 deletions
  1. 3 3
      README.MD
  2. 9 7
      gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py
  3. BIN
      weixinzhishu/.DS_Store

+ 3 - 3
README.MD

@@ -60,9 +60,9 @@ ps aux | grep run_youtube | grep -v grep | awk '{print $2}' | xargs kill -9
 #### 微信指数
 ```commandline
 微信指数杀进程
-nohup python3 -u /data5/piaoquan_crawler/weixinzhishu/weixinzhishu_main/weixinzhishu_inner_sort.py >>/data5/piaoquan_crawler//weixinzhishu/nohup_inner_sort.log 2>&1 &
-nohup python3 -u /data5/piaoquan_crawler/weixinzhishu/weixinzhishu_main/weixinzhishu_inner_long.py >>/data5/piaoquan_crawler//weixinzhishu/nohup_inner_long.log 2>&1 &
-nohup python3 -u /data5/piaoquan_crawler/weixinzhishu/weixinzhishu_main/weixinzhishu_out.py >>/data5/piaoquan_crawler//weixinzhishu/nohup_out.log 2>&1 &
+nohup python3 -u /data5/piaoquan_crawler/weixinzhishu/weixinzhishu_main/weixinzhishu_inner_sort.py >>/data5/piaoquan_crawler/weixinzhishu/nohup_inner_sort.log 2>&1 &
+nohup python3 -u /data5/piaoquan_crawler/weixinzhishu/weixinzhishu_main/weixinzhishu_inner_long.py >>/data5/piaoquan_crawler/weixinzhishu/nohup_inner_long.log 2>&1 &
+nohup python3 -u /data5/piaoquan_crawler/weixinzhishu/weixinzhishu_main/weixinzhishu_out.py >>/data5/piaoquan_crawler/weixinzhishu/nohup_out.log 2>&1 &
 ps aux | grep run_weixinzhishu
 ps aux | grep weixinzhishu | grep -v grep | awk '{print $2}' | xargs kill -9
 获取 wechat_key 设备: Mac Air 

+ 9 - 7
gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

@@ -114,7 +114,7 @@ class GongzhonghaoFollow:
             urllib3.disable_warnings()
             r = requests.get(url=url, headers=headers, params=params, verify=False)
             while True:
-                if r.status_code != 200 and 21 >= datetime.datetime.now().hour >= 10:
+                if r.json()["base_resp"]["err_msg"] == "invalid session" and 21 >= datetime.datetime.now().hour >= 10:
                     Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                     Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
                     Feishu.bot(log_type, crawler, "token过期啦,请扫码更换\nhttps://mp.weixin.qq.com/")
@@ -228,7 +228,7 @@ class GongzhonghaoFollow:
                 urllib3.disable_warnings()
                 r = requests.get(url=url, headers=headers, params=params, verify=False)
                 while True:
-                    if r.status_code != 200 and 21 >= datetime.datetime.now().hour >= 10:
+                    if r.json()["base_resp"]["err_msg"] == "invalid session" and 21 >= datetime.datetime.now().hour >= 10:
                         Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                         Common.logger(log_type, crawler).info(f"response:{r.text}")
                         Feishu.bot(log_type, crawler, "token过期啦,请扫码更换\nhttps://mp.weixin.qq.com/")
@@ -310,7 +310,7 @@ class GongzhonghaoFollow:
                     Common.logger(log_type, crawler).info('休眠 5 秒\n')
                     time.sleep(5)
             except Exception as e:
-                Common.logger(log_type, crawler).error("get_gzh_url异常:{}\n", e)
+                Common.logger(log_type, crawler).error("get_videoList异常:{}\n", e)
 
     @classmethod
     def repeat_video(cls, log_type, crawler, video_id, env):
@@ -546,8 +546,10 @@ class GongzhonghaoFollow:
 
 
 if __name__ == "__main__":
-    # like_score = GongzhonghaoFollow.title_like("follow", "gongzhonghao", "最减寿的习惯,不是抽烟,不是喝酒,而是这三样", "prod")
-    # print(like_score)
-    # print(GongzhonghaoFollow.get_token("follow", "gongzhonghao"))
-    GongzhonghaoFollow.get_users()
+    GongzhonghaoFollow.get_videoList(log_type="follow",
+                                     crawler="gongzhonghao",
+                                     user="香音难忘",
+                                     index=1,
+                                     oss_endpoint="out",
+                                     env="dev")
     pass

BIN
weixinzhishu/.DS_Store