mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-31 06:09:47 +08:00
fix(baoyu-fetch): parse YouTube /embed/ URLs in parseYouTubeVideoId
parseYouTubeVideoId handled watch, youtu.be, /shorts/ and /live/ URLs but not the common /embed/<id> player form, so embed links returned null and the YouTube adapter treated them as "no document". Add an /embed/ branch mirroring the existing /shorts/ and /live/ handling, with a regression test.
This commit is contained in:
@@ -19,6 +19,10 @@ describe("parseYouTubeVideoId", () => {
|
||||
test("parses shorts URLs", () => {
|
||||
expect(parseYouTubeVideoId(new URL("https://www.youtube.com/shorts/abc123"))).toBe("abc123");
|
||||
});
|
||||
|
||||
test("parses embed URLs", () => {
|
||||
expect(parseYouTubeVideoId(new URL("https://www.youtube.com/embed/abc123"))).toBe("abc123");
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseYouTubeDescriptionChapters", () => {
|
||||
|
||||
Reference in New Issue
Block a user