diff --git a/package.json b/package.json index 034ca7a..4c075ad 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cobalt", "description": "save what you love", - "version": "7.1.2", + "version": "7.1.3", "author": "wukko", "exports": "./src/cobalt.js", "type": "module", diff --git a/src/modules/processing/hostOverrides.js b/src/modules/processing/hostOverrides.js index 211cd2a..11104bd 100644 --- a/src/modules/processing/hostOverrides.js +++ b/src/modules/processing/hostOverrides.js @@ -3,10 +3,16 @@ export default function (inHost, inURL) { let url = String(inURL); switch(host) { + case "youtube": + if (url.startsWith("https://youtube.com/live/") || url.startsWith("https://www.youtube.com/")) { + url = url.split("?")[0].replace("www.", ""); + url = `https://youtube.com/watch?v=${url.replace("https://youtube.com/live/", "")}` + } + break; case "youtu": if (url.startsWith("https://youtu.be/")) { host = "youtube"; - url = `https://youtube.com/watch?v=${url.replace("https://youtu.be/", "")}`; + url = `https://youtube.com/watch?v=${url.replace("https://youtu.be/", "")}` } break; case "vxtwitter": diff --git a/src/test/tests.json b/src/test/tests.json index 3415550..905f5c7 100644 --- a/src/test/tests.json +++ b/src/test/tests.json @@ -465,6 +465,14 @@ "code": 200, "status": "stream" } + }, { + "name": "live link, defaults", + "url": "https://www.youtube.com/live/ENxZS6PUDuI?feature=shared", + "params": {}, + "expected": { + "code": 200, + "status": "stream" + } }, { "name": "inexistent video", "url": "https://youtube.com/watch?v=gnjuHYWGEW",