-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update YoutubeLoader implementation
- Loading branch information
Showing
4 changed files
with
57 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
libs/langchain-community/src/document_loaders/tests/youtube.int.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { test, expect } from "@jest/globals"; | ||
import { YoutubeLoader } from "../web/youtube.js"; | ||
|
||
test("Test Youtube loader", async () => { | ||
const videoUrl = "https://www.youtube.com/watch?v=FZhbJZEgKQ4"; | ||
const loader = YoutubeLoader.createFromUrl(videoUrl, { | ||
language: "en", | ||
addVideoInfo: true, | ||
}); | ||
const docs = await loader.load(); | ||
|
||
expect(docs.length).toBe(1); | ||
expect(docs[0].pageContent).toContain( | ||
"One year ago, at the dawn of a new age," | ||
); | ||
expect(docs[0].metadata).toMatchObject({ | ||
author: "Microsoft", | ||
source: "FZhbJZEgKQ4", | ||
title: "Full Keynote: Satya Nadella at Microsoft Ignite 2023", | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters