wangkun 1 年之前
父節點
當前提交
3af5e4a869
共有 1 個文件被更改,包括 10 次插入8 次删除
  1. 10 8
      shipinhao/shipinhao_search/shipinhao_search.py

+ 10 - 8
shipinhao/shipinhao_search/shipinhao_search.py

@@ -268,12 +268,14 @@ class ShipinhaoSearch:
     def search_video(cls, log_type, crawler, word, driver: WebDriver, our_uid, env):
         # 点击微信搜索框,并输入搜索词
         driver.implicitly_wait(10)
+        Common.logger(log_type, crawler).info("点击微信搜索框")
         driver.find_element(By.ID, 'com.tencent.mm:id/j5t').click()
         time.sleep(0.5)
         Common.logger(log_type, crawler).info(f'输入搜索词:{word}')
         driver.find_element(By.ID, 'com.tencent.mm:id/cd7').clear().send_keys(word)
         driver.press_keycode(AndroidKey.ENTER)
         # driver.find_elements(By.ID, 'com.tencent.mm:id/oi4')[0].click()
+        Common.logger(log_type, crawler).info("点击搜索,进入搜索页")
         driver.find_elements(By.ID, 'com.tencent.mm:id/oi4')[0].click()
         time.sleep(5)
 
@@ -660,14 +662,14 @@ class ShipinhaoSearch:
             search_word = user["search_word"]
             our_uid = user["our_uid"]
             Common.logger(log_type, crawler).info(f"开始抓取搜索词:{search_word}")
-            # try:
-            cls.start_wechat(log_type=log_type,
-                             crawler=crawler,
-                             word=search_word,
-                             our_uid=our_uid,
-                             env=env)
-            # except Exception as e:
-            #     Common.logger(log_type, crawler).error(f"search_video:{e}\n")
+            try:
+                cls.start_wechat(log_type=log_type,
+                                 crawler=crawler,
+                                 word=search_word,
+                                 our_uid=our_uid,
+                                 env=env)
+            except Exception as e:
+                Common.logger(log_type, crawler).error(f"search_video:{e}\n")
 
 
 if __name__ == '__main__':