运行子程序(检索-浏览器历史)失败。解析表达式出错。
内部错误:无法将类型为“Newtonsoft.Json.Linq.JArray”的对象强制转换为类型“Newtonsoft.Json.Linq.JObject”。
原始表达式:
int tabsnum=0;
if({allTabs}!=null){
// 标签数量
tabsnum={allTabs}.Count;
{totalHistoryArray}= new JArray({allTabs}.Concat({totalHistoryArray}));
}
// 总的历史记录
JArray totalHistoryArray = new JArray({totalHistoryArray}.Where(item => !string.IsNullOrEmpty(item["title"].ToString()))
.GroupBy(item => item["title"].ToString())
.Select(group => group.First()));
// 原本有url、title三项
JArray jArray = new JArray();
JArray keywordBlacklist=(JArray){config}["keywordBlacklist"];
int i=0;
foreach (JObject item in totalHistoryArray){
string url = item["url"].ToString();
var o = new JObject();
o["Icon"]=$"https://helperservice.getquicker.cn/favicon/get/{new Uri(url).Host}";
o["Title"]=item["title"].ToString().Replace("|", "丨");
o["Description"]="【浏览器历史记录】 "+url;
if(i<tabsnum){
o["Description"]="【浏览器窗口】 " + url;
if(i==0){
o["Description"]="【浏览器当前窗口】 " + url;
}
i=i+1;
}
o["Operation"]="callback";
o["DataType"]= "text";
o["Data"]=url;
// 连接quicker插件
if(tabsnum!=0){
JArray Children = new JArray(
new JObject(
new JProperty("Icon", "url:https://files.getquicker.net/_icons/52FEDD9AAA2E08FA22BAE44AE03CA4857ED13776.png"),
new JProperty("Title", "无痕模式打开"),
new JProperty("Data", "historyIncognito"),
new JProperty("Description", null)
),
new JObject(
new JProperty("Icon", "fa:Brands_Chrome:#577AE7"),
new JProperty("Title", "删除浏览器历史"),
new JProperty("Data", "historyDeletion"),
new JProperty("Description", "支持全部删除、指定日期删除、关键字删除")
)
);
o["Children"]=Children;
}
string select=o["Title"]+new Uri(url).Host;
o["select"]=select;
if(keywordBlacklist.Values<string>().Any(wordBlack => select.Contains(wordBlack))){
continue;
}
jArray.Add(o);
}
return jArray.ToString();(赋值)
(----灵搜v214:运行子程序----)