mirror of
https://github.com/mendableai/firecrawl.git
synced 2025-12-12 15:41:20 +00:00
Nick: extract urls to extract
This commit is contained in:
parent
2fb8a3c8dc
commit
d02a8bcb82
@ -50,7 +50,7 @@ const main = async () => {
|
||||
links: z.array(z.string())
|
||||
});
|
||||
|
||||
const extractResult = await app.extractUrls(['https://firecrawl.dev'], {
|
||||
const extractResult = await app.extract(['https://firecrawl.dev'], {
|
||||
prompt: "Extract the title, description, and links from the website",
|
||||
schema: extractSchema
|
||||
});
|
||||
|
||||
@ -699,12 +699,12 @@ export default class FirecrawlApp {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts information from a URL using the Firecrawl API.
|
||||
* Extracts information from URLs using the Firecrawl API.
|
||||
* @param url - The URL to extract information from.
|
||||
* @param params - Additional parameters for the extract request.
|
||||
* @returns The response from the extract operation.
|
||||
*/
|
||||
async extractUrls(urls: string[], params?: ExtractParams): Promise<ExtractResponse | ErrorResponse> {
|
||||
async extract(urls: string[], params?: ExtractParams): Promise<ExtractResponse | ErrorResponse> {
|
||||
const headers = this.prepareHeaders();
|
||||
|
||||
if (!params?.prompt) {
|
||||
|
||||
@ -124,7 +124,7 @@ class ExtractSchema(BaseModel):
|
||||
extract_schema = ExtractSchema.schema()
|
||||
|
||||
# Perform the extraction
|
||||
extract_result = app.extract_urls(['https://firecrawl.dev'], {
|
||||
extract_result = app.extract(['https://firecrawl.dev'], {
|
||||
'prompt': "Extract the title, description, and links from the website",
|
||||
'schema': extract_schema
|
||||
})
|
||||
|
||||
@ -460,7 +460,7 @@ class FirecrawlApp:
|
||||
self._handle_error(response, 'check batch scrape status')
|
||||
|
||||
|
||||
def extract_urls(self, urls: List[str], params: Optional[ExtractParams] = None) -> Union[ExtractResponse, ErrorResponse]:
|
||||
def extract(self, urls: List[str], params: Optional[ExtractParams] = None) -> Union[ExtractResponse, ErrorResponse]:
|
||||
"""
|
||||
Extracts information from a URL using the Firecrawl API.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user