[PR #832] [MERGED] api/url: extract loom video id from longer links #8670

Closed
opened 2026-04-21 20:41:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/imputnet/cobalt/pull/832
Author: @styxnanda
Created: 10/10/2024
Status: Merged
Merged: 2/11/2025
Merged by: @wukko

Base: mainHead: loom-fix-branch


📝 Commits (2)

  • ab52297 api/src/services/url: support for longer Loom URL variant containing content ID
  • 0c1f6b5 api/processing: reformat

📊 Changes

1 file changed (+8 additions, -0 deletions)

View changed files

📝 api/src/processing/url.js (+8 -0)

📄 Description

Background

This is in response to #799.

It's not really a bug, but the original code intended the ID for Loom videos to be at most 32 characters. For example, https://www.loom.com/share/4a2a8baf124c4390954dcbb46a58cfd7.

However, apparently Loom has a longer URL variant that has the title encoded as well such as https://www.loom.com/share/Unlocking-Incredible-Organizational-Velocity-with-Async-Video-4a2a8baf124c4390954dcbb46a58cfd7.

However, I did notice that in this longer variant URL form, the URL actually contains the ID right at the end of the path. For example in https://www.loom.com/share/Unlocking-Incredible-Organizational-Velocity-with-Async-Video-4a2a8baf124c4390954dcbb46a58cfd7, the ID of the video is 4a2a8baf124c4390954dcbb46a58cfd7.

Solving Attempt

So, what I did is pretty much utilize the function aliasURL in url.js to provide support for this URL variant. Then, I changed the URL pathname to the correct format so the patternMatch is the exact ID to be later on tested by the tester pattern by extracting the last 32 characters from the supposed id containing more than 32 characters. Here's the code mentioned.

case "loom":
    const idPart = parts[parts.length - 1];
    if(idPart.length > 32){
        const actualIdPart = idPart.slice(-32);
        url.pathname = `/share/${actualIdPart}`;
    }
    break;

Test Result

I've done a manual test using Yaak and it succeeds in the supposedly unyielding URLs.
image

I've run npm run test as well and met some failures in reddit, streamable, and vimeo test cases but this is because those sites are banned in my country. It shouldn't affect those at all though.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/imputnet/cobalt/pull/832 **Author:** [@styxnanda](https://github.com/styxnanda) **Created:** 10/10/2024 **Status:** ✅ Merged **Merged:** 2/11/2025 **Merged by:** [@wukko](https://github.com/wukko) **Base:** `main` ← **Head:** `loom-fix-branch` --- ### 📝 Commits (2) - [`ab52297`](https://github.com/imputnet/cobalt/commit/ab52297613f10b6749ec41030abb8c9a5dd15836) api/src/services/url: support for longer Loom URL variant containing content ID - [`0c1f6b5`](https://github.com/imputnet/cobalt/commit/0c1f6b56dc18f244c6c49e38d67eda508091817e) api/processing: reformat ### 📊 Changes **1 file changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `api/src/processing/url.js` (+8 -0) </details> ### 📄 Description ## Background This is in response to #799. It's not really a bug, but the original code intended the ID for Loom videos to be at most 32 characters. For example, `https://www.loom.com/share/4a2a8baf124c4390954dcbb46a58cfd7`. However, apparently Loom has a longer URL variant that has the title encoded as well such as `https://www.loom.com/share/Unlocking-Incredible-Organizational-Velocity-with-Async-Video-4a2a8baf124c4390954dcbb46a58cfd7`. However, I did notice that in this longer variant URL form, the URL actually contains the ID right at the end of the path. For example in `https://www.loom.com/share/Unlocking-Incredible-Organizational-Velocity-with-Async-Video-4a2a8baf124c4390954dcbb46a58cfd7`, the ID of the video is `4a2a8baf124c4390954dcbb46a58cfd7`. ## Solving Attempt So, what I did is pretty much utilize the function `aliasURL` in `url.js` to provide support for this URL variant. Then, I changed the URL pathname to the correct format so the patternMatch is the exact ID to be later on tested by the tester pattern by extracting the last 32 characters from the supposed `id` containing more than 32 characters. Here's the code mentioned. ```Javascript case "loom": const idPart = parts[parts.length - 1]; if(idPart.length > 32){ const actualIdPart = idPart.slice(-32); url.pathname = `/share/${actualIdPart}`; } break; ``` ## Test Result I've done a manual test using Yaak and it succeeds in the supposedly unyielding URLs. ![image](https://github.com/user-attachments/assets/17369c05-ecc6-4d00-b35f-10bcd3632556) I've run `npm run test` as well and met some failures in reddit, streamable, and vimeo test cases but this is because those sites are banned in my country. It shouldn't affect those at all though. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-21 20:41:01 -05:00
Sign in to join this conversation.