Skip to content

Commit

Permalink
feat(community): Return metadata.title from CheerioDocumentLoader (#7437
Browse files Browse the repository at this point in the history
)
  • Loading branch information
KoreanThinker authored Dec 31, 2024
1 parent 7e7df50 commit 33c3d73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/langchain-community/src/document_loaders/web/cheerio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ export class CheerioWebBaseLoader
*/
async load(): Promise<Document[]> {
const $ = await this.scrape();
const title = $("title").text();
const text = $(this.selector).text();
const metadata = { source: this.webPath };
const metadata = { source: this.webPath, title };
return [new Document({ pageContent: text, metadata })];
}

Expand Down

0 comments on commit 33c3d73

Please sign in to comment.