Skip to content

best way to save what you love

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

Satya Anandad6b0fbc8ecb2
diff --git a/api/src/processing/url.js b/api/src/processing/url.js
index f4a5c5b1..82299999 100644
--- a/api/src/processing/url.js
+++ b/api/src/processing/url.js
@@ -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;