feat(js-sdk): add crawlUrlAndWatch
This commit is contained in:
@@ -32,8 +32,24 @@ const main = async () => {
|
||||
console.log(checkStatus.data[0].markdown);
|
||||
}
|
||||
|
||||
// Map a website:
|
||||
const mapResult = await app.mapUrl('https://firecrawl.dev');
|
||||
console.log(mapResult)
|
||||
|
||||
// Crawl a website with WebSockets:
|
||||
const watch = await app.crawlUrlAndWatch('mendable.ai', { excludePaths: ['blog/*'], limit: 5});
|
||||
|
||||
watch.addEventListener("document", doc => {
|
||||
console.log("DOC", doc.detail);
|
||||
});
|
||||
|
||||
watch.addEventListener("error", err => {
|
||||
console.error("ERR", err.detail.error);
|
||||
});
|
||||
|
||||
watch.addEventListener("done", state => {
|
||||
console.log("DONE", state.detail.status);
|
||||
});
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user