Accept YouTube /live/ and /shorts/ URLs in extractVideoId
The video-id regex only matched /watch?v=, youtu.be, /embed/, and /v/ forms, so youtube.com/live/<id> and youtube.com/shorts/<id> links were rejected with "Invalid YouTube URL". Add both forms to the server and frontend extractors (kept in sync) and cover them with tests. Ship as 0.2.159.
This commit is contained in:
@@ -22,6 +22,17 @@ describe("extractVideoId", () => {
|
||||
assert.equal(extractVideoId("https://www.youtube.com/embed/dQw4w9WgXcQ"), "dQw4w9WgXcQ");
|
||||
});
|
||||
|
||||
test("extracts from /live/ URL (with ?si tracking param)", () => {
|
||||
assert.equal(
|
||||
extractVideoId("https://www.youtube.com/live/QEq1Fa-Br0U?si=CqlsUBpyTs_ksqi3"),
|
||||
"QEq1Fa-Br0U"
|
||||
);
|
||||
});
|
||||
|
||||
test("extracts from /shorts/ URL", () => {
|
||||
assert.equal(extractVideoId("https://www.youtube.com/shorts/dQw4w9WgXcQ"), "dQw4w9WgXcQ");
|
||||
});
|
||||
|
||||
test("accepts a bare 11-character id", () => {
|
||||
assert.equal(extractVideoId("dQw4w9WgXcQ"), "dQw4w9WgXcQ");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user