@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 4.03 kB
Source Map (JSON)
{"version":3,"file":"cheerio.d.cts","names":["CheerioAPI","CheerioOptions","load","LoadT","SelectorType","Document","AsyncCaller","BaseDocumentLoader","WebBaseLoaderParams","WebBaseLoader","CheerioWebBaseLoaderParams","CheerioWebBaseLoader","TextDecoder","HeadersInit","Promise"],"sources":["../../../src/document_loaders/web/cheerio.d.ts"],"sourcesContent":["import type { CheerioAPI, CheerioOptions, load as LoadT, SelectorType } from \"cheerio\";\nimport { Document } from \"@langchain/core/documents\";\nimport { AsyncCaller } from \"@langchain/core/utils/async_caller\";\nimport { BaseDocumentLoader } from \"@langchain/core/document_loaders/base\";\nimport type { WebBaseLoaderParams, WebBaseLoader } from \"./html.js\";\n/**\n * Represents the parameters for configuring the CheerioWebBaseLoader. It\n * extends the WebBaseLoaderParams interface and adds additional parameters\n * specific to loading with Cheerio.\n */\nexport interface CheerioWebBaseLoaderParams extends WebBaseLoaderParams {\n /**\n * The selector to use to extract the text from the document. Defaults to\n * \"body\".\n */\n selector?: SelectorType;\n}\n/**\n * A class that extends the BaseDocumentLoader and implements the\n * DocumentLoader interface. It represents a document loader for loading\n * web-based documents using Cheerio.\n * @example\n * ```typescript\n * const loader = new CheerioWebBaseLoader(\"https://exampleurl.com\");\n * const docs = await loader.load();\n * console.log({ docs });\n * ```\n */\nexport declare class CheerioWebBaseLoader extends BaseDocumentLoader implements WebBaseLoader {\n webPath: string;\n timeout: number;\n caller: AsyncCaller;\n selector?: SelectorType;\n textDecoder?: TextDecoder;\n headers?: HeadersInit;\n constructor(webPath: string, fields?: CheerioWebBaseLoaderParams);\n /**\n * Fetches web documents from the given array of URLs and loads them using Cheerio.\n * It returns an array of CheerioAPI instances.\n * @param urls An array of URLs to fetch and load.\n * @returns A Promise that resolves to an array of CheerioAPI instances.\n */\n static scrapeAll(urls: string[], caller: AsyncCaller, timeout: number | undefined, textDecoder?: TextDecoder, options?: CheerioOptions & {\n headers?: HeadersInit;\n }): Promise<CheerioAPI[]>;\n static _scrape(url: string, caller: AsyncCaller, timeout: number | undefined, textDecoder?: TextDecoder, options?: CheerioOptions & {\n headers?: HeadersInit;\n }): Promise<CheerioAPI>;\n /**\n * Fetches the web document from the webPath and loads it using Cheerio.\n * It returns a CheerioAPI instance.\n * @returns A Promise that resolves to a CheerioAPI instance.\n */\n scrape(): Promise<CheerioAPI>;\n /**\n * Extracts the text content from the loaded document using the selector\n * and creates a Document instance with the extracted text and metadata.\n * It returns an array of Document instances.\n * @returns A Promise that resolves to an array of Document instances.\n */\n load(): Promise<Document[]>;\n /**\n * A static method that dynamically imports the Cheerio library and\n * returns the load function. If the import fails, it throws an error.\n * @returns A Promise that resolves to an object containing the load function from the Cheerio library.\n */\n static imports(): Promise<{\n load: typeof LoadT;\n }>;\n}\n//# sourceMappingURL=cheerio.d.ts.map"],"mappings":";;;;;;;;;;AAUA;AAkBA;;AAIeI,UAtBEM,0BAAAA,SAAmCF,mBAsBrCJ,CAAAA;EACGQ;;;;EASmFA,QAAAA,CAAAA,EA3BtFR,YA2BsFQ;;;;;;;;;;;;;AAkBjFP,cAhCCM,oBAAAA,SAA6BJ,kBAAAA,YAA8BE,aAgC5DJ,CAAAA;EAARS,OAAAA,EAAAA,MAAAA;EAOSX,OAAAA,EAAAA,MAAAA;EADCW,MAAAA,EAnCVR,WAmCUQ;EAtC4BP,QAAAA,CAAAA,EAInCH,YAJmCG;EAA8BE,WAAAA,CAAAA,EAK9DG,WAL8DH;EAAa,OAAA,CAAA,EAM/EI,WAN+E;wCAOnDH;;;;;;;2CAOGJ,wDAAwDM,uBAAuBX;cAC1GY;MACVC,QAAQd;sCACwBM,wDAAwDM,uBAAuBX;cACrGY;MACVC,QAAQd;;;;;;YAMFc,QAAQd;;;;;;;UAOVc,QAAQT;;;;;;oBAMES;iBACDX"}