|
@@ -115,7 +115,7 @@ class KanyikanRecommend:
|
|
|
driver.switch_to.window(handle)
|
|
|
time.sleep(1)
|
|
|
try:
|
|
|
- driver.find_element(By.XPATH, "//wx-view[@class='new-bottom-tabs']//wx-view[1]")
|
|
|
+ driver.find_element(By.XPATH, "//wx-view[@class='snapshot--video-button']//wx-view[1]")
|
|
|
Common.logger(log_type, crawler).info("切换到小程序成功\n")
|
|
|
Common.logging(log_type, crawler, env, '切换到小程序成功\n')
|
|
|
return
|
|
@@ -163,7 +163,7 @@ class KanyikanRecommend:
|
|
|
|
|
|
page = 0
|
|
|
while True:
|
|
|
- if cls.search_elements(driver, "//wx-view[@class='new-bottom-tabs']//wx-view[1]") is None:
|
|
|
+ if cls.search_elements(driver, "//wx-view[@class='snapshot--video-button']//wx-view[1]") is None:
|
|
|
Common.logger(log_type, crawler).info("窗口已销毁\n")
|
|
|
Common.logging(log_type, crawler, env, '窗口已销毁\n')
|
|
|
cls.i = 0
|
|
@@ -329,6 +329,7 @@ class KanyikanRecommend:
|
|
|
time.sleep(5)
|
|
|
cls.swipe_up(driver)
|
|
|
except Exception as e:
|
|
|
+ driver.press_keycode(AndroidKey.BACK)
|
|
|
Common.logger(log_type, crawler).error(f"抓取单条视频异常:{e}\n")
|
|
|
Common.logging(log_type, crawler, env, f"抓取单条视频异常:{e}\n")
|
|
|
Common.logger(log_type, crawler).info("已抓取完一组,休眠 5 秒\n")
|