mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-19 23:14:54 +08:00
单个单元格限制提醒
This commit is contained in:
parent
528ae7a132
commit
145c766221
@ -38,6 +38,24 @@ ws.onmessage = function(evt) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function changeOutputFormat(para){
|
||||||
|
try{
|
||||||
|
for(let i=0;i<para["parameters"].length;i++) {
|
||||||
|
let exampleValue = para["parameters"][i]["exampleValues"][0]["value"];
|
||||||
|
let len = exampleValue.length;
|
||||||
|
if (len > 20000) {
|
||||||
|
if($("#outputFormat").val() == "xlsx") {
|
||||||
|
$("#outputFormat").val("csv"); //如果有一个参数的示例值长度超过20000,就默认输出为csv
|
||||||
|
showInfo(LANG("示例值长度超过16000,超出Excel单个单元格存储限制,已自动切换保存为csv格式。", "The length of the example value exceeds 16000, and the csv save format has been automatically switched."));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(e){
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function changeGetDataParameters(msg, i) {
|
function changeGetDataParameters(msg, i) {
|
||||||
msg["parameters"][i]["default"] = ""; //找不到元素时候的默认值
|
msg["parameters"][i]["default"] = ""; //找不到元素时候的默认值
|
||||||
msg["parameters"][i]["paraType"] = "text"; //参数类型
|
msg["parameters"][i]["paraType"] = "text"; //参数类型
|
||||||
@ -82,16 +100,19 @@ function handleAddElement(msg) {
|
|||||||
changeGetDataParameters(msg, i);
|
changeGetDataParameters(msg, i);
|
||||||
app._data["nowNode"]["parameters"]["paras"].push(msg["parameters"][i]);
|
app._data["nowNode"]["parameters"]["paras"].push(msg["parameters"][i]);
|
||||||
}
|
}
|
||||||
|
changeOutputFormat(msg);
|
||||||
app._data.paras.parameters = app._data["nowNode"]["parameters"]["paras"];
|
app._data.paras.parameters = app._data["nowNode"]["parameters"]["paras"];
|
||||||
setTimeout(function(){$("#app > div.elements > div.toolkitcontain > table.toolkittb4 > tbody > tr:last-child")[0].scrollIntoView(false); //滚动到底部
|
setTimeout(function(){$("#app > div.elements > div.toolkitcontain > table.toolkittb4 > tbody > tr:last-child")[0].scrollIntoView(false); //滚动到底部
|
||||||
}, 200);
|
}, 200);
|
||||||
} else {
|
} else {
|
||||||
addElement(3, msg);
|
addElement(3, msg);
|
||||||
|
changeOutputFormat(msg);
|
||||||
}
|
}
|
||||||
notifyParameterNum(msg["parameters"].length); //通知浏览器端参数的个数变化
|
notifyParameterNum(msg["parameters"].length); //通知浏览器端参数的个数变化
|
||||||
} else if (msg["type"] == "multiCollectWithPattern") {
|
} else if (msg["type"] == "multiCollectWithPattern") {
|
||||||
addElement(8, msg);
|
addElement(8, msg);
|
||||||
addElement(3, msg);
|
addElement(3, msg);
|
||||||
|
changeOutputFormat(msg);
|
||||||
notifyParameterNum(msg["parameters"].length); //通知浏览器端参数的个数变化
|
notifyParameterNum(msg["parameters"].length); //通知浏览器端参数的个数变化
|
||||||
} else if(msg["type"] == "GetCookies"){
|
} else if(msg["type"] == "GetCookies"){
|
||||||
for(let node of nodeList){
|
for(let node of nodeList){
|
||||||
|
1
ElectronJS/tasks/202.json
Normal file
1
ElectronJS/tasks/202.json
Normal file
File diff suppressed because one or more lines are too long
2
ExecuteStage/.vscode/launch.json
vendored
2
ExecuteStage/.vscode/launch.json
vendored
@ -12,7 +12,7 @@
|
|||||||
"justMyCode": false,
|
"justMyCode": false,
|
||||||
// "args": ["--id", "[7]", "--read_type", "remote", "--headless", "0"]
|
// "args": ["--id", "[7]", "--read_type", "remote", "--headless", "0"]
|
||||||
// "args": ["--id", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
|
// "args": ["--id", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
|
||||||
"args": ["--id", "[16]", "--headless", "0", "--user_data", "1", "--keyboard", "0"]
|
"args": ["--id", "[85]", "--headless", "0", "--user_data", "1", "--keyboard", "0"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -101,6 +101,7 @@ def download_image(browser, url, save_directory):
|
|||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
|
||||||
}
|
}
|
||||||
if is_valid_url(url):
|
if is_valid_url(url):
|
||||||
|
try:
|
||||||
# 发送 GET 请求获取图片数据
|
# 发送 GET 请求获取图片数据
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
|
|
||||||
@ -121,14 +122,18 @@ def download_image(browser, url, save_directory):
|
|||||||
file.write(response.content)
|
file.write(response.content)
|
||||||
|
|
||||||
browser.print_and_log("图片已成功下载到:", save_path)
|
browser.print_and_log("图片已成功下载到:", save_path)
|
||||||
browser.print_and_log("The image has been successfully downloaded to:", save_path)
|
browser.print_and_log(
|
||||||
|
"The image has been successfully downloaded to:", save_path)
|
||||||
else:
|
else:
|
||||||
browser.print_and_log("下载图片失败,请检查此图片链接是否有效:", url)
|
browser.print_and_log("下载图片失败,请检查此图片链接是否有效:", url)
|
||||||
browser.print_and_log(
|
browser.print_and_log(
|
||||||
"Failed to download image, please check if this image link is valid:", url)
|
"Failed to download image, please check if this image link is valid:", url)
|
||||||
|
except Exception as e:
|
||||||
|
browser.print_and_log("下载图片失败|Error downloading image: ", e)
|
||||||
else:
|
else:
|
||||||
browser.print_and_log("下载图片失败,请检查此图片链接是否有效:", url)
|
browser.print_and_log("下载图片失败,请检查此图片链接是否有效:", url)
|
||||||
browser.print_and_log("Failed to download image, please check if this image link is valid:", url)
|
browser.print_and_log(
|
||||||
|
"Failed to download image, please check if this image link is valid:", url)
|
||||||
|
|
||||||
|
|
||||||
def get_output_code(output):
|
def get_output_code(output):
|
||||||
@ -217,6 +222,7 @@ def write_to_json(file_name, data, types, record, keys):
|
|||||||
with open(file_name, 'w', encoding='utf-8') as f:
|
with open(file_name, 'w', encoding='utf-8') as f:
|
||||||
json.dump(json_data, f, ensure_ascii=False)
|
json.dump(json_data, f, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
def write_to_excel(file_name, data, types, record):
|
def write_to_excel(file_name, data, types, record):
|
||||||
first = False
|
first = False
|
||||||
if os.path.exists(file_name):
|
if os.path.exists(file_name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user