wangkun 1 year ago
parent
commit
11dcfae905
1 changed files with 3 additions and 0 deletions
  1. 3 0
      xigua/xigua_search/xigua_search.py

+ 3 - 0
xigua/xigua_search/xigua_search.py

@@ -729,6 +729,7 @@ class XiguasearchScheduling:
         if driver.find_elements(By.XPATH, '//*[@class="xg-notification-close"]') != 0:
             driver.find_element(By.XPATH, '//*[@class="xg-notification-close"]').click()
 
+        page = 0
         while True:
             # 查找视频列表
             video_elements = driver.find_elements(By.XPATH, '//*[@class="HorizontalFeedCard__coverWrapper disableZoomAnimation"]')
@@ -745,12 +746,14 @@ class XiguasearchScheduling:
                 Common.logging(log_type, crawler, env, f"已扫描 {len(video_elements)} 条视频\n")
                 break
             else:
+                page += 1
                 # 拖动列表最后一条视频至屏幕中间
                 Common.logger(log_type, crawler).info("拖动列表最后一条视频至屏幕中间")
                 Common.logging(log_type, crawler, env, "拖动列表最后一条视频至屏幕中间")
                 action = ActionChains(driver)
                 action.move_to_element(video_elements[-1]).perform()
                 time.sleep(1)
+                driver.get_screenshot_as_file(f"./{crawler}/photos/{page}.png")
 
         for i, video_element in enumerate(video_elements):
             try: