Files
wiki_crawler/nodes/parse_firecrawl_map.py
2025-12-22 22:08:51 +08:00

23 lines
611 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
def main(map_json: list[dict]):
"""
将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 {
"urls": map_obj["links"],
"code": int(map_obj["success"]),
}