wangkun 1 年之前
父节点
当前提交
11dcfae905
共有 1 个文件被更改,包括 3 次插入0 次删除
  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:
         if driver.find_elements(By.XPATH, '//*[@class="xg-notification-close"]') != 0:
             driver.find_element(By.XPATH, '//*[@class="xg-notification-close"]').click()
             driver.find_element(By.XPATH, '//*[@class="xg-notification-close"]').click()
 
 
+        page = 0
         while True:
         while True:
             # 查找视频列表
             # 查找视频列表
             video_elements = driver.find_elements(By.XPATH, '//*[@class="HorizontalFeedCard__coverWrapper disableZoomAnimation"]')
             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")
                 Common.logging(log_type, crawler, env, f"已扫描 {len(video_elements)} 条视频\n")
                 break
                 break
             else:
             else:
+                page += 1
                 # 拖动列表最后一条视频至屏幕中间
                 # 拖动列表最后一条视频至屏幕中间
                 Common.logger(log_type, crawler).info("拖动列表最后一条视频至屏幕中间")
                 Common.logger(log_type, crawler).info("拖动列表最后一条视频至屏幕中间")
                 Common.logging(log_type, crawler, env, "拖动列表最后一条视频至屏幕中间")
                 Common.logging(log_type, crawler, env, "拖动列表最后一条视频至屏幕中间")
                 action = ActionChains(driver)
                 action = ActionChains(driver)
                 action.move_to_element(video_elements[-1]).perform()
                 action.move_to_element(video_elements[-1]).perform()
                 time.sleep(1)
                 time.sleep(1)
+                driver.get_screenshot_as_file(f"./{crawler}/photos/{page}.png")
 
 
         for i, video_element in enumerate(video_elements):
         for i, video_element in enumerate(video_elements):
             try:
             try: