mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 03:32:22 +08:00
Merge branch 'main' of https://github.com/mendableai/firecrawl
This commit is contained in:
commit
15fd4e23d8
20
apps/js-sdk/example.js
Normal file
20
apps/js-sdk/example.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { FirecrawlApp } from '@mendableai/firecrawl-js';
|
||||
|
||||
const app = new FirecrawlApp({apiKey: "YOUR_API_KEY"});
|
||||
|
||||
const crawlResult = await app.crawlUrl('mendable.ai', {crawlerOptions: {excludes: ['blog/*'], limit: 5}}, false);
|
||||
console.log(crawlResult)
|
||||
|
||||
const jobId = await crawlResult['jobId'];
|
||||
console.log(jobId);
|
||||
|
||||
let job;
|
||||
while (true) {
|
||||
job = await app.checkCrawlStatus(jobId);
|
||||
if (job.status == 'completed') {
|
||||
break;
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 1000)); // wait 1 second
|
||||
}
|
||||
|
||||
console.log(job.data[0].content);
|
16
apps/js-sdk/package.json
Normal file
16
apps/js-sdk/package.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "js-example",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "example.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8"
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
from firecrawl import FirecrawlApp
|
||||
|
||||
|
||||
app = FirecrawlApp(api_key="a6a2d63a-ed2b-46a9-946d-2a7207efed4d")
|
||||
app = FirecrawlApp(api_key="YOUR_API_KEY")
|
||||
|
||||
crawl_result = app.crawl_url('mendable.ai', {'crawlerOptions': {'excludes': ['blog/*']}})
|
||||
print(crawl_result[0]['markdown'])
|
||||
|
|
Loading…
Reference in New Issue
Block a user