-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from kenu/transcript
🐛 transcript bug fix
- Loading branch information
Showing
13 changed files
with
49 additions
and
83 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
import fetchTranscript from '../web/utils/transcript.js' | ||
import { YoutubeTranscript } from "youtube-transcript"; | ||
|
||
test('', async() => { | ||
const videoId = 'ulqHnefBFMM' | ||
const transcript = await fetchTranscript(videoId) | ||
expect(transcript).not.toBeNull() | ||
}) | ||
const videoId = "vSIb2sPdu9U"; | ||
test("getTextOnly", async () => { | ||
const transcript = await YoutubeTranscript.fetchTranscript(videoId); | ||
expect(transcript).not.toBeNull(); | ||
const fullText = getTextOnly(transcript); | ||
expect(fullText).toContain("인데"); | ||
}); | ||
|
||
function getTextOnly(transcript) { | ||
return transcript.map((item) => item.text).join(" "); | ||
} | ||
|
||
test('remove [Object, Object]', async () => { | ||
const pattern = /(니다|하죠|하겠죠|고요|까요|네요|데요|세요|아요|어요)\s/g | ||
const transcript = await YoutubeTranscript.fetchTranscript(videoId) | ||
let fullText = transcript.map((item) => item.text).join(' ') | ||
fullText = fullText.replaceAll(pattern, '$1. ') | ||
expect(fullText).not.toContain('Object') | ||
}); |
File renamed without changes.
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
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 was deleted.
Oops, something went wrong.
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
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