@mendable/firecrawl-js 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -77,6 +77,42 @@ To scrape a single URL with error handling, use the `scrapeUrl` method. It takes
77
77
  scrapeExample();
78
78
  ```
79
79
 
80
+ ### Extracting structured data from a URL
81
+
82
+ With LLM extraction, you can easily extract structured data from any URL. We support zod schemas to make it easier for you too. Here is how you to use it:
83
+
84
+ ```js
85
+ import { z } from "zod";
86
+
87
+ const zodSchema = z.object({
88
+ top: z
89
+ .array(
90
+ z.object({
91
+ title: z.string(),
92
+ points: z.number(),
93
+ by: z.string(),
94
+ commentsURL: z.string(),
95
+ })
96
+ )
97
+ .length(5)
98
+ .describe("Top 5 stories on Hacker News"),
99
+ });
100
+
101
+ let llmExtractionResult = await app.scrapeUrl("https://news.ycombinator.com", {
102
+ extractorOptions: { extractionSchema: zodSchema },
103
+ });
104
+
105
+ console.log(llmExtractionResult.data.llm_extraction);
106
+ ```
107
+
108
+ ### Search for a query
109
+
110
+ Used to search the web, get the most relevant results, scrap each page and return the markdown.
111
+
112
+ ```js
113
+ query = 'what is mendable?'
114
+ searchResult = app.search(query)
115
+ ```
80
116
 
81
117
  ### Crawling a Website
82
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl-js",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "build/index.js",
6
6
  "types": "types/index.d.ts",