bilibili: add support for b23.tv links

resolves #320
This commit is contained in:
dumbmoron
2024-02-15 01:42:15 +00:00
parent d70754238e
commit 6e1eddad82
6 changed files with 38 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ export function aliasURL(url) {
url.search = `?v=${encodeURIComponent(parts[2])}`
}
break;
case "youtu":
if (url.hostname === 'youtu.be' && parts.length >= 2) {
/* youtu.be urls can be weird, e.g. https://youtu.be/<id>//asdasd// still works
@@ -25,6 +26,7 @@ export function aliasURL(url) {
}`)
}
break;
case "pin":
if (url.hostname === 'pin.it' && parts.length === 2) {
url = new URL(`https://pinterest.com/url_shortener/${
@@ -46,6 +48,12 @@ export function aliasURL(url) {
url = new URL(`https://twitch.tv/_/clip/${parts[1]}`);
}
break;
case "b23":
if (url.hostname === 'b23.tv' && parts.length === 2) {
url = new URL(`https://bilibili.com/_shortLink/${parts[1]}`)
}
break;
}
return url