|
@@ -242,21 +242,21 @@ class GongzhonghaoFollow2:
|
|
r = requests.get(url=url, headers=headers, params=params, verify=False)
|
|
r = requests.get(url=url, headers=headers, params=params, verify=False)
|
|
if r.json()["base_resp"]["err_msg"] == "invalid session":
|
|
if r.json()["base_resp"]["err_msg"] == "invalid session":
|
|
Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
|
|
Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
|
|
- Common.logger(log_type, crawler).info(f"response:{r.text}")
|
|
|
|
|
|
+ Common.logger(log_type, crawler).info(f"get_videoList:{r.text}")
|
|
if 20 >= datetime.datetime.now().hour >= 10:
|
|
if 20 >= datetime.datetime.now().hour >= 10:
|
|
Feishu.bot(log_type, crawler, f"token_2:{token_dict['gzh_name']}\n更换日期:{token_dict['gzh_time']}\n过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
|
|
Feishu.bot(log_type, crawler, f"token_2:{token_dict['gzh_name']}\n更换日期:{token_dict['gzh_time']}\n过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
|
|
time.sleep(60 * 10)
|
|
time.sleep(60 * 10)
|
|
continue
|
|
continue
|
|
if r.json()["base_resp"]["err_msg"] == "freq control":
|
|
if r.json()["base_resp"]["err_msg"] == "freq control":
|
|
Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
|
|
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")
|
|
|
|
|
|
+ Common.logger(log_type, crawler).warning(f"get_videoList:{r.text}\n")
|
|
if 20 >= datetime.datetime.now().hour >= 10:
|
|
if 20 >= datetime.datetime.now().hour >= 10:
|
|
Feishu.bot(log_type, crawler, f"公众号_2:{token_dict['gzh_name']}\n更换日期:{token_dict['gzh_time']}\n频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
|
|
Feishu.bot(log_type, crawler, f"公众号_2:{token_dict['gzh_name']}\n更换日期:{token_dict['gzh_time']}\n频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
|
|
time.sleep(60 * 10)
|
|
time.sleep(60 * 10)
|
|
continue
|
|
continue
|
|
if 'app_msg_list' not in r.json():
|
|
if 'app_msg_list' not in r.json():
|
|
Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
|
|
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")
|
|
|
|
|
|
+ Common.logger(log_type, crawler).warning(f"get_videoList:{r.text}\n")
|
|
if 20 >= datetime.datetime.now().hour >= 10:
|
|
if 20 >= datetime.datetime.now().hour >= 10:
|
|
Feishu.bot(log_type, crawler, f"公众号_2:{token_dict['gzh_name']}\n更换日期:{token_dict['gzh_time']}\n频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
|
|
Feishu.bot(log_type, crawler, f"公众号_2:{token_dict['gzh_name']}\n更换日期:{token_dict['gzh_time']}\n频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
|
|
time.sleep(60 * 10)
|
|
time.sleep(60 * 10)
|
|
@@ -330,8 +330,8 @@ class GongzhonghaoFollow2:
|
|
return
|
|
return
|
|
cls.download_publish(log_type, crawler, video_dict, oss_endpoint, env)
|
|
cls.download_publish(log_type, crawler, video_dict, oss_endpoint, env)
|
|
|
|
|
|
- Common.logger(log_type, crawler).info('随机休眠 60-60*3 秒\n')
|
|
|
|
- time.sleep(random.randint(60, 60*3))
|
|
|
|
|
|
+ Common.logger(log_type, crawler).info('随机休眠 60*3-60*8 秒\n')
|
|
|
|
+ time.sleep(random.randint(60*5, 60*10))
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type, crawler).error(f"get_videoList异常:{e}\n")
|
|
Common.logger(log_type, crawler).error(f"get_videoList异常:{e}\n")
|
|
|
|
|
|
@@ -492,18 +492,18 @@ class GongzhonghaoFollow2:
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def get_all_videos(cls, log_type, crawler, oss_endpoint, env):
|
|
def get_all_videos(cls, log_type, crawler, oss_endpoint, env):
|
|
- try:
|
|
|
|
- user_list = cls.get_users()
|
|
|
|
- for user_dict in user_list:
|
|
|
|
|
|
+ user_list = cls.get_users()
|
|
|
|
+ for user_dict in user_list:
|
|
|
|
+ try:
|
|
user_name = user_dict['user_name']
|
|
user_name = user_dict['user_name']
|
|
index = user_dict['index']
|
|
index = user_dict['index']
|
|
Common.logger(log_type, crawler).info(f'获取 {user_name} 公众号视频\n')
|
|
Common.logger(log_type, crawler).info(f'获取 {user_name} 公众号视频\n')
|
|
cls.get_videoList(log_type, crawler, user_name, index, oss_endpoint, env)
|
|
cls.get_videoList(log_type, crawler, user_name, index, oss_endpoint, env)
|
|
cls.begin = 0
|
|
cls.begin = 0
|
|
- Common.logger(log_type, crawler).info('随机休眠 60-60*3 秒\n')
|
|
|
|
- time.sleep(random.randint(60, 60*3))
|
|
|
|
- except Exception as e:
|
|
|
|
- Common.logger(log_type, crawler).info(f'get_all_videos异常:{e}\n')
|
|
|
|
|
|
+ Common.logger(log_type, crawler).info('随机休眠 60*5, 60*10 秒\n')
|
|
|
|
+ time.sleep(random.randint(60*5, 60*10))
|
|
|
|
+ except Exception as e:
|
|
|
|
+ Common.logger(log_type, crawler).info(f'get_all_videos异常:{e}\n')
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|