2025-12-29 11:29:52 +08:00
|
|
|
|
def main(map_json: list[dict]):
|
2025-12-22 22:08:51 +08:00
|
|
|
|
"""
|
|
|
|
|
|
将Firecrawl Map节点的输出转换为干净的输出,避免杂七杂八的数据干扰
|
|
|
|
|
|
输入: Firecrawl Map节点的输出,结构如下
|
|
|
|
|
|
"map_json": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"links": [
|
|
|
|
|
|
"http://example.com/page1",
|
|
|
|
|
|
"http://example.com/page2"
|
|
|
|
|
|
],
|
|
|
|
|
|
"success": true,
|
|
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
因为比较简单而且与firecrawl组件绑定比,所以就直接main里写完了
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
map_obj = map_json[0]
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
2025-12-29 11:29:52 +08:00
|
|
|
|
# "urls": map_obj["links"],
|
|
|
|
|
|
# "code": int(map_obj["success"]),
|
|
|
|
|
|
"urls_obj": {
|
|
|
|
|
|
"urls": map_obj["links"]
|
|
|
|
|
|
}
|
2025-12-22 22:08:51 +08:00
|
|
|
|
}
|
2025-12-29 11:29:52 +08:00
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
返回值示例
|
|
|
|
|
|
{
|
|
|
|
|
|
"urls_obj": {
|
|
|
|
|
|
"urls": [
|
|
|
|
|
|
"http://example.com/page1",
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
'''
|