wangkun 2 years ago
parent
commit
e1f477b093
2 changed files with 14 additions and 13 deletions
  1. 3 4
      main/demo.py
  2. 11 9
      shipinhao/shipinhao_follow.py

+ 3 - 4
main/demo.py

@@ -26,11 +26,10 @@ class Demo:
 
     @classmethod
     def get_sht(cls):
-        sht = Feishu.get_values_batch('recommend', 'shipinhao', 'c77cf9')
-        name1 = sht[1][14]
-        name2 = sht[2][14]
+        sht = Feishu.get_values_batch('recommend', 'shipinhao', 'XxmRlE')
+        title = '穷人怎么变富上海爷叔句句肺腑,短短一席话令人深思'
 
-        if '胡成功很努力' in name1 and '胡成功很努力' in name2:
+        if str(title) in [x for y in sht for x in y]:
             print('yes')
         else:
             print('no')

+ 11 - 9
shipinhao/shipinhao_follow.py

@@ -145,7 +145,7 @@ class Follow:
 
         # 判断置顶视频
         top_videos = driver.find_elements(By.ID, 'com.tencent.mm:id/i56')
-        Common.logger(log_type).info(f'发现置顶视频{len(top_videos)}个\n')
+        Common.logger(log_type).info(f'发现 {len(top_videos)} 个置顶视频\n')
         if len(top_videos) == 0:
             Common.logger(log_type).info('当前用户没有置顶视频')
         else:
@@ -155,7 +155,9 @@ class Follow:
                 driver.press_keycode(AndroidKey.BACK)
 
         # 判断非置顶视频
-        not_top_first_video = driver.find_elements(By.ID, 'com.tencent.mm:id/nmz')[len(top_videos)]
+        not_top_videos = driver.find_elements(By.ID, 'com.tencent.mm:id/nmz')
+        Common.logger(log_type).info(f'发现 {len(not_top_videos)} 个非置顶视频')
+        not_top_first_video = not_top_videos[len(top_videos)]
         not_top_first_video.click()
         while True:
             cls.download_publish(log_type, driver, env)
@@ -412,13 +414,13 @@ class Follow:
 
     @classmethod
     def search_to_all_user_homepage(cls, log_type, env):
-        try:
-            user_list = cls.get_users_from_feishu(log_type)
-            for user in user_list:
-                cls.start_follow_wechat(log_type, user, env)
-            Common.logger(log_type).info('所有用户已抓取完毕\n')
-        except Exception as e:
-            Common.logger(log_type).error(f'search_to_all_user_homepage异常:{e}\n')
+        # try:
+        user_list = cls.get_users_from_feishu(log_type)
+        for user in user_list:
+            cls.start_follow_wechat(log_type, user, env)
+        Common.logger(log_type).info('所有用户已抓取完毕\n')
+        # except Exception as e:
+        #     Common.logger(log_type).error(f'search_to_all_user_homepage异常:{e}\n')
 
 
 if __name__ == '__main__':