api/url: extract loom video id from longer links (#832)

Co-authored-by: jj <log@riseup.net>
This commit is contained in:
Satya Ananda 2025-02-11 15:52:20 +07:00 committed by GitHub
parent 20b1d9ab30
commit d6b0fbc8ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -98,6 +98,14 @@ function aliasURL(url) {
if (url.hostname === 'xhslink.com' && parts.length === 3) {
url = new URL(`https://www.xiaohongshu.com/a/${parts[2]}`);
}
break;
case "loom":
const idPart = parts[parts.length - 1];
if (idPart.length > 32) {
url.pathname = `/share/${idPart.slice(-32)}`;
}
break;
}
return url;