youtube: added support for live links
This commit is contained in:
parent
b56edfc193
commit
be21c86d89
3 changed files with 16 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "cobalt",
|
"name": "cobalt",
|
||||||
"description": "save what you love",
|
"description": "save what you love",
|
||||||
"version": "7.1.2",
|
"version": "7.1.3",
|
||||||
"author": "wukko",
|
"author": "wukko",
|
||||||
"exports": "./src/cobalt.js",
|
"exports": "./src/cobalt.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
@ -3,10 +3,16 @@ export default function (inHost, inURL) {
|
||||||
let url = String(inURL);
|
let url = String(inURL);
|
||||||
|
|
||||||
switch(host) {
|
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":
|
case "youtu":
|
||||||
if (url.startsWith("https://youtu.be/")) {
|
if (url.startsWith("https://youtu.be/")) {
|
||||||
host = "youtube";
|
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;
|
break;
|
||||||
case "vxtwitter":
|
case "vxtwitter":
|
||||||
|
|
|
@ -465,6 +465,14 @@
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"status": "stream"
|
"status": "stream"
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"name": "live link, defaults",
|
||||||
|
"url": "https://www.youtube.com/live/ENxZS6PUDuI?feature=shared",
|
||||||
|
"params": {},
|
||||||
|
"expected": {
|
||||||
|
"code": 200,
|
||||||
|
"status": "stream"
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
"name": "inexistent video",
|
"name": "inexistent video",
|
||||||
"url": "https://youtube.com/watch?v=gnjuHYWGEW",
|
"url": "https://youtube.com/watch?v=gnjuHYWGEW",
|
||||||
|
|
Loading…
Reference in a new issue