Browse Source

Merge branch 'master' of https://git.yishihui.com/Server/piaoquan_crawler

lierqiang 2 years ago
parent
commit
cc14222c1c

+ 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 

BIN
gongzhonghao/.DS_Store


BIN
gongzhonghao/videos/.DS_Store → gongzhonghao/gongzhonghao_follow/.DS_Store


+ 62 - 72
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/")
@@ -165,7 +165,8 @@ class GongzhonghaoFollow:
             if env == "prod":
                 driver = webdriver.Chrome(desired_capabilities=ca, options=chrome_options)
             else:
-                driver = webdriver.Chrome(desired_capabilities=ca, options=chrome_options, service=Service('/Users/wangkun/Downloads/chromedriver/chromedriver_v111/chromedriver'))
+                driver = webdriver.Chrome(desired_capabilities=ca, options=chrome_options, service=Service(
+                    '/Users/wangkun/Downloads/chromedriver/chromedriver_v111/chromedriver'))
 
             driver.implicitly_wait(10)
             # Common.logger(log_type, crawler).info('打开文章链接')
@@ -228,7 +229,8 @@ 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 +312,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):
@@ -461,72 +463,57 @@ class GongzhonghaoFollow:
         #         "index": index,
         #     }
         #     user_list.append(user_dict)
+        # print(len(user_list))
         # print(user_list)
-        user_list = [{'user_name': '香音难忘', 'index': 1},
-                     {'user_name': '墨儿心灵驿站', 'index': 1},
-                     {'user_name': '荒烟茶生', 'index': 1},
-                     {'user_name': '幸福花朵', 'index': 1},
-                     {'user_name': '我的节日祝福', 'index': 1},
-                     {'user_name': '生活创意妙招', 'index': 1},
-                     {'user_name': '二大妈有话说', 'index': 1},
-                     {'user_name': '医路健康美食', 'index': 1},
-                     {'user_name': '老年相知相伴', 'index': 1},
-                     {'user_name': '一争', 'index': 1},
-                     {'user_name': '老年企退群', 'index': 1},
-                     {'user_name': '消逝的哨声', 'index': 1},
-                     {'user_name': '一颗打破石头的蛋', 'index': 1},
-                     {'user_name': '叩问苍穹荒烟茶生', 'index': 1},
-                     {'user_name': '布衣星火', 'index': 1},
-                     {'user_name': '叩问苍穹', 'index': 1},
-                     {'user_name': '微观调查', 'index': 2},
-                     {'user_name': '传统节日祝福', 'index': 1},
-                     {'user_name': '因和德尚', 'index': 1},
-                     {'user_name': '飨宴心灵', 'index': 1},
-                     {'user_name': '朝闻解局', 'index': 1},
-                     {'user_name': '远见光芒', 'index': 1},
-                     {'user_name': '墨儿微刊', 'index': 1},
-                     {'user_name': '博爱论', 'index': 1},
-                     {'user_name': '张大春讲堂', 'index': 1},
-                     {'user_name': ' 司马南频道', 'index': 1},
-                     {'user_name': '音乐小镇', 'index': 1},
-                     {'user_name': '节日祝福365', 'index': 1},
-                     {'user_name': '动画音乐相册', 'index': 1},
-                     {'user_name': '音乐动漫相册', 'index': 1},
-                     {'user_name': '早点谈健康', 'index': 1},
-                     {'user_name': '早点谈养生', 'index': 1},
-                     {'user_name': '早点谈养身', 'index': 1},
-                     {'user_name': '医道谈养身', 'index': 1},
-                     {'user_name': '中老年谈养身', 'index': 1},
-                     {'user_name': '尼古拉斯瞭望', 'index': 1},
-                     {'user_name': '奇易时光百姓的福音', 'index': 1},
-                     {'user_name': '寰宇时光', 'index': 1},
-                     {'user_name': '红兴文化公苑', 'index': 1},
-                     {'user_name': '早点音乐', 'index': 1},
-                     {'user_name': '小分子生物活性肽', 'index': 1},
-                     {'user_name': '张小妹美食', 'index': 1},
-                     {'user_name': '万物归息', 'index': 1},
-                     {'user_name': '神州红魂', 'index': 1},
-                     {'user_name': '音乐早餐', 'index': 1},
-                     {'user_name': '1条末读消息', 'index': 1},
-                     {'user_name': '环球文摘', 'index': 1},
-                     {'user_name': '精彩有余', 'index': 1},
-                     {'user_name': '一起训练吧', 'index': 1},
-                     {'user_name': '1条重要消息', 'index': 1},
-                     {'user_name': '太上养身', 'index': 1},
-                     {'user_name': '懂点养身秘诀', 'index': 1},
-                     {'user_name': '送乐者', 'index': 1},
-                     {'user_name': '蜂业小百科', 'index': 1},
-                     {'user_name': '健康与养身秘诀', 'index': 1},
-                     {'user_name': '有心人r', 'index': 1},
-                     {'user_name': '古诗词世界', 'index': 1},
-                     {'user_name': '晨间悦读', 'index': 1},
-                     {'user_name': '养身有诀窍', 'index': 1},
-                     {'user_name': '退休族信息圈', 'index': 1},
-                     {'user_name': '艾公铁粉团', 'index': 1},
-                     {'user_name': '酸甜苦辣麻咸', 'index': 1},
-                     {'user_name': '日常生活小帮手', 'index': 1},
-                     {'user_name': '小帅的精彩视频', 'index': 1},
-                     {'user_name': '养身常识小窍门', 'index': 1}]
+        user_list = [{'user_name': '香音难忘', 'index': 1}, {'user_name': '墨儿心灵驿站', 'index': 1},
+                     {'user_name': '荒烟茶生', 'index': 1}, {'user_name': '幸福花朵', 'index': 1},
+                     {'user_name': '我的节日祝福', 'index': 1}, {'user_name': '生活创意妙招', 'index': 1},
+                     {'user_name': '二大妈有话说', 'index': 1}, {'user_name': '医路健康美食', 'index': 1},
+                     {'user_name': '老年相知相伴', 'index': 1}, {'user_name': '一争', 'index': 1},
+                     {'user_name': '老年企退群', 'index': 1}, {'user_name': '消逝的哨声', 'index': 1},
+                     {'user_name': '一颗打破石头的蛋', 'index': 1}, {'user_name': '叩问苍穹荒烟茶生', 'index': 1},
+                     {'user_name': '布衣星火', 'index': 1}, {'user_name': '叩问苍穹', 'index': 1},
+                     {'user_name': '微观调查', 'index': 2}, {'user_name': '传统节日祝福', 'index': 1},
+                     {'user_name': '因和德尚', 'index': 1}, {'user_name': '飨宴心灵', 'index': 1},
+                     {'user_name': '朝闻解局', 'index': 1}, {'user_name': '远见光芒', 'index': 1},
+                     {'user_name': '墨儿微刊', 'index': 1}, {'user_name': '博爱论', 'index': 1},
+                     {'user_name': '张大春讲堂', 'index': 1}, {'user_name': ' 司马南频道', 'index': 1},
+                     {'user_name': '音乐小镇', 'index': 1}, {'user_name': '节日祝福365', 'index': 1},
+                     {'user_name': '动画音乐相册', 'index': 1}, {'user_name': '音乐动漫相册', 'index': 1},
+                     {'user_name': '早点谈健康', 'index': 1}, {'user_name': '早点谈养生', 'index': 1},
+                     {'user_name': '早点谈养身', 'index': 1}, {'user_name': '医道谈养身', 'index': 1},
+                     {'user_name': '中老年谈养身', 'index': 1}, {'user_name': '尼古拉斯瞭望', 'index': 1},
+                     {'user_name': '奇易时光百姓的福音', 'index': 1}, {'user_name': '寰宇时光', 'index': 1},
+                     {'user_name': '红兴文化公苑', 'index': 1}, {'user_name': '早点音乐', 'index': 1},
+                     {'user_name': '小分子生物活性肽', 'index': 1}, {'user_name': '张小妹美食', 'index': 1},
+                     {'user_name': '万物归息', 'index': 1}, {'user_name': '神州红魂', 'index': 1},
+                     {'user_name': '音乐早餐', 'index': 1}, {'user_name': '1条末读消息', 'index': 1},
+                     {'user_name': '环球文摘', 'index': 1}, {'user_name': '精彩有余', 'index': 1},
+                     {'user_name': '一起训练吧', 'index': 1}, {'user_name': '1条重要消息', 'index': 1},
+                     {'user_name': '太上养身', 'index': 1}, {'user_name': '懂点养身秘诀', 'index': 1},
+                     {'user_name': '送乐者', 'index': 1}, {'user_name': '蜂业小百科', 'index': 1},
+                     {'user_name': '健康与养身秘诀', 'index': 1}, {'user_name': '有心人r', 'index': 1},
+                     {'user_name': '古诗词世界', 'index': 1}, {'user_name': '晨间悦读', 'index': 1},
+                     {'user_name': '养身有诀窍', 'index': 1}, {'user_name': '退休族信息圈', 'index': 1},
+                     {'user_name': '艾公铁粉团', 'index': 1}, {'user_name': '酸甜苦辣麻咸', 'index': 1},
+                     {'user_name': '日常生活小帮手', 'index': 1}, {'user_name': '小帅的精彩视频', 'index': 1},
+                     {'user_name': '养身常识小窍门', 'index': 1}, {'user_name': '医学养身技巧', 'index': 1},
+                     {'user_name': '退休圈', 'index': 1}, {'user_name': '生活小助手', 'index': 1},
+                     {'user_name': '经典老歌曲好听的音乐', 'index': 1}, {'user_name': '黑马快讯', 'index': 1},
+                     {'user_name': '绝妙经典', 'index': 1}, {'user_name': '深读时策', 'index': 1},
+                     {'user_name': '健康与生活大全', 'index': 1}, {'user_name': '李肃论道', 'index': 1},
+                     {'user_name': '爱国者吹锋号', 'index': 1}, {'user_name': '兵心可鉴', 'index': 1},
+                     {'user_name': '精选动心金曲', 'index': 1}, {'user_name': '爱二胡群', 'index': 1},
+                     {'user_name': '数码科技大爆炸', 'index': 1}, {'user_name': '何静同学', 'index': 1},
+                     {'user_name': '方敏爱美食', 'index': 1}, {'user_name': '针灸推拿特色技术', 'index': 1},
+                     {'user_name': '挺进天山', 'index': 1}, {'user_name': '紫陌捻花', 'index': 1},
+                     {'user_name': '巨响养身', 'index': 1}, {'user_name': '荣观世界', 'index': 1},
+                     {'user_name': 'Music音乐世界', 'index': 1}, {'user_name': '微观调查组', 'index': 1},
+                     {'user_name': '用汉方拥抱世界', 'index': 1}, {'user_name': '医学养身秘诀', 'index': 1},
+                     {'user_name': '医学老人养身', 'index': 1}, {'user_name': '热文微观', 'index': 1},
+                     {'user_name': '医学养身秘笈', 'index': 1}, {'user_name': '你未读消息', 'index': 2},
+                     {'user_name': '6点谈健康', 'index': 1}]
+
         return user_list
 
     @classmethod
@@ -546,8 +533,11 @@ 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