mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-20 04:39:57 +08:00
replace variables
This commit is contained in:
parent
8c3a613014
commit
c9eb5b0932
@ -1071,6 +1071,9 @@ class BrowserThread(Thread):
|
|||||||
break
|
break
|
||||||
elif int(node["parameters"]["loopType"]) == 3: # 固定文本列表
|
elif int(node["parameters"]["loopType"]) == 3: # 固定文本列表
|
||||||
textList = node["parameters"]["textList"].split("\n")
|
textList = node["parameters"]["textList"].split("\n")
|
||||||
|
if len(textList) == 1: # 如果固定文本列表只有一行,现在就可以替换变量
|
||||||
|
textList = replace_field_values(
|
||||||
|
node["parameters"]["textList"], self.outputParameters).split("\n")
|
||||||
for text in textList:
|
for text in textList:
|
||||||
text = replace_field_values(text, self.outputParameters)
|
text = replace_field_values(text, self.outputParameters)
|
||||||
# self.recordLog("当前循环文本|Current loop text:", text)
|
# self.recordLog("当前循环文本|Current loop text:", text)
|
||||||
@ -1092,6 +1095,9 @@ class BrowserThread(Thread):
|
|||||||
# tempList = node["parameters"]["textList"].split("\r\n")
|
# tempList = node["parameters"]["textList"].split("\r\n")
|
||||||
urlList = list(
|
urlList = list(
|
||||||
filter(isnotnull, node["parameters"]["textList"].split("\n"))) # 去空行
|
filter(isnotnull, node["parameters"]["textList"].split("\n"))) # 去空行
|
||||||
|
if len(urlList) == 1: # 如果固定网址列表只有一行,现在就可以替换变量
|
||||||
|
urlList = replace_field_values(
|
||||||
|
node["parameters"]["textList"], self.outputParameters).split("\n")
|
||||||
# urlList = []
|
# urlList = []
|
||||||
# for url in tempList:
|
# for url in tempList:
|
||||||
# if url != "":
|
# if url != "":
|
||||||
@ -1516,7 +1522,7 @@ class BrowserThread(Thread):
|
|||||||
content = select_element.first_selected_option.text
|
content = select_element.first_selected_option.text
|
||||||
except:
|
except:
|
||||||
content = ""
|
content = ""
|
||||||
elif p["contentType"] == 14: # 元素属性值
|
elif p["contentType"] == 14: # 元素属性值
|
||||||
attribute_name = p["JS"]
|
attribute_name = p["JS"]
|
||||||
try:
|
try:
|
||||||
content = element.get_attribute(attribute_name)
|
content = element.get_attribute(attribute_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user