Browse Source

Bug fix

pull/254/head
naibo 9 months ago
parent
commit
7511de816c
7 changed files with 16 additions and 5 deletions
  1. +1
    -0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/0.json
  2. +1
    -0
      .temp_to_pub/EasySpider_windows_x64/execution_instances/1.json
  3. +1
    -0
      .temp_to_pub/EasySpider_windows_x64/tasks/296.json
  4. BIN
      ElectronJS/EasySpider_en.crx
  5. BIN
      ElectronJS/EasySpider_zh.crx
  6. +1
    -1
      ExecuteStage/.vscode/launch.json
  7. +12
    -4
      ExecuteStage/easyspider_executestage.py

+ 1
- 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/0.json
File diff suppressed because it is too large
View File


+ 1
- 0
.temp_to_pub/EasySpider_windows_x64/execution_instances/1.json
File diff suppressed because it is too large
View File


+ 1
- 0
.temp_to_pub/EasySpider_windows_x64/tasks/296.json
File diff suppressed because it is too large
View File


BIN
ElectronJS/EasySpider_en.crx View File


BIN
ElectronJS/EasySpider_zh.crx View File


+ 1
- 1
ExecuteStage/.vscode/launch.json View File

@ -12,7 +12,7 @@
"justMyCode": false,
// "args": ["--ids", "[7]", "--read_type", "remote", "--headless", "0"]
// "args": ["--ids", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
"args": ["--ids", "[58]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
"args": ["--ids", "[1]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
"--read_type", "remote"]
// "args": "--ids '[97]' --user_data 1 --server_address http://localhost:8074 --config_folder '/Users/naibo/Documents/EasySpider/ElectronJS/' --headless 0 --read_type remote --config_file_name config.json --saved_file_name"
}

+ 12
- 4
ExecuteStage/easyspider_executestage.py View File

@ -1115,10 +1115,18 @@ class BrowserThread(Thread):
if node["parameters"]["exitCount"] == 0:
# newBodyText = self.browser.find_element(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"]).text
# 用find_elements获取所有匹配到的文本
exitElements = self.browser.find_elements(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"])
newBodyText = ""
for exitElement in exitElements:
newBodyText += exitElement.text
try:
exitElements = self.browser.find_elements(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"])
newBodyText = ""
for exitElement in exitElements:
newBodyText += exitElement.text
except Exception as e:
self.print_and_log(f"设定的退出循环元素:{node['parameters']['exitElement']}的文本无法获取,本次循环将不再检测元素文本是否变化,将会继续执行,为解决此问题,您可以修改检测元素文本不变的元素为其他元素,或者将循环次数设定为固定次数大于0的值。")
self.print_and_log(f"The text of the exit loop element set: {node['parameters']['exitElement']} cannot be obtained, this loop will no longer check whether the text of the element has changed, and will continue to execute. To solve this problem, you can modify the element whose text does not change to other elements, or set the number of loops to a fixed number greater than 0.")
self.print_and_log(e)
exitElements = []
# newBodyText为随机文本,保证一直执行
newBodyText = str(random.random())
if node["parameters"]["iframe"]: # 如果标记了iframe
iframes = self.browser.find_elements(
By.CSS_SELECTOR, "iframe", iframe=False)

Loading…
Cancel
Save