mirror of
https://github.com/imputnet/cobalt.git
synced 2026-11-04 00:35:06 +00:00
youtube: added support for live links
This commit is contained in:
parent
b56edfc193
commit
be21c86d89
3 changed files with 16 additions and 2 deletions
|
|
@ -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":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue