@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 2.24 kB
Source Map (JSON)
{"version":3,"file":"hn.d.cts","names":["Document","CheerioWebBaseLoader","HNLoader","Promise"],"sources":["../../../src/document_loaders/web/hn.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport { CheerioWebBaseLoader } from \"./cheerio.js\";\n/**\n * A class that extends the CheerioWebBaseLoader class. It represents a\n * loader for loading web pages from the Hacker News website.\n */\nexport declare class HNLoader extends CheerioWebBaseLoader {\n webPath: string;\n constructor(webPath: string);\n /**\n * An asynchronous method that loads the web page. If the webPath includes\n * \"item\", it calls the loadComments() method to load the comments from\n * the web page. Otherwise, it calls the loadResults() method to load the\n * results from the web page.\n * @returns A Promise that resolves to an array of Document instances.\n */\n load(): Promise<Document[]>;\n /**\n * A private method that loads the comments from the web page. It selects\n * the elements with the class \"athing comtr\" using the $ function\n * provided by Cheerio. It also extracts the title of the web page from\n * the element with the id \"pagespace\". It creates Document instances for\n * each comment, with the comment text as the page content and the source\n * and title as metadata.\n * @param $ A CheerioAPI instance.\n * @returns An array of Document instances.\n */\n private loadComments;\n /**\n * A private method that loads the results from the web page. It selects\n * the elements with the class \"athing\" using the $ function provided by\n * Cheerio. It extracts the ranking, link, title, and other metadata from\n * each result item. It creates Document instances for each result item,\n * with the title as the page content and the source, title, link, and\n * ranking as metadata.\n * @param $ A CheerioAPI instance.\n * @returns An array of Document instances.\n */\n private loadResults;\n}\n//# sourceMappingURL=hn.d.ts.map"],"mappings":";;;;;;;AAMA;;AAUYG,cAVSD,QAAAA,SAAiBD,oBAAAA,CAU1BE;EAV0BF,OAAAA,EAAAA,MAAAA;EAAoB,WAAA,CAAA,OAAA,EAAA,MAAA;;;;;;;;UAU9CE,QAAQH"}