Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site request: Support for loom.com #27957

Open
5 tasks done
solonovamax opened this issue Jan 25, 2021 · 10 comments · May be fixed by #28039
Open
5 tasks done

Site request: Support for loom.com #27957

solonovamax opened this issue Jan 25, 2021 · 10 comments · May be fixed by #28039
Labels
site-support-request Add extractor(s) for a new domain

Comments

@solonovamax
Copy link

solonovamax commented Jan 25, 2021

Checklist

  • I'm reporting a new site support request
  • I've verified that I'm running youtube-dl version 2021.01.24.1 (I'm not actually running 2021.01.24.1; I'm running 2021.01.16 since that's the latest version in the AUR, but I check the changelog and the site was not supported between these releases.)
  • I've checked that all provided URLs are alive and playable in a browser
  • I've searched the bugtracker for similar site support requests including closed ones
  • I've checked that none of provided URLs violate any copyrights

Example URLs

(More can be found by just searching for site:loom.com/share on a search engine like duckduckgo or google. These are just from their help pages.)

Description

From what I understood from the loom website, it's basically like a shitier version of youtube that doesn't have public videos and requires you to install an extension/desktop app instead of using OBS. So basically worthless.

But, for some reason, my teacher decided to use it for a video she put up. (Since I don't want to dox myself, I just put support videos in the example URL list.) And since she was talking stupidly slowly, so I wanted to download it and then watch it. Turns out youtube-dl didn't already have that capability, so I'm opening an issue for it.

Anyway, the site seems to be simple enough. Ignoring their fancy JS player, the video turns out to literally just be a webm video that's downloaded from their cdn. (If you check the network logs when you watch a video, it seems to send a request with a URL that looks like: https://cdn.loom.com/sessions/raw/[VIDEO-ID].webm?Expires=[EXPIRY-TIME]&Policy=[POLICY-VALUE]&Signature=[SIGNATURE-VALUE]&Key-Pair-Id=[KEY-PAIR]. (Where [VIDEO-ID] is from the main URL: https://www.loom.com/share/[VIDEO-ID])
I don't know where the POLICY-VALUE, SIGNATURE-VALUE, or KEY-PAIR come from. It seems that the entire Expires=[EXPIRY-TIME]& item can be removed, without it changing anything. (Though, if you remove the policy, it will say that it's missing the expiry. Not sure why, since it works without the expiry... Though, that could be unintentional on their end, and might be patched at some point.)
This URL comes from a request the browser makes to the https://www.loom.com/api/campaigns/sessions/[VIDEO-ID]/raw-url URL, which returns a JSON formatted string, where the url key holds the reference to the cdn.

If I just take that URL and do youtube-dl https://cdn.loom.com/sessions/raw/. . ., then it'll download the webm video properly. So implementing this shouldn't be too hard, just parse the video id, POST the endpoint for the cdn URL, and then download that like a normal webm/etc. video.

Though, checking another URL it also seems to have this other video with a .ts extension?? idk, mpv says it's the mpegts format, encoded in h264. I don't recognize that format though.
The URL I got that from is here. It also seems to have split that video into multiple parts, but I don't think it did that on other videos. Idk, I didn't look into how this works that much since I'm lazy.

If you guys decide not to implement this (because nobody uses this service), I'm fine with that too. I just wanted to make this because it seems like it'd be trivially easy to implement. (I would make a PR for it myself, except I'm a java developer and my python code looks like shit. You probably wouldn't want it anyway.)

@solonovamax solonovamax added the site-support-request Add extractor(s) for a new domain label Jan 25, 2021
@october262
Copy link

for this link - https://www.loom.com/share/31b41727a5b24dacb6c1417a565b2ebf
press F12 on your keyboard to bring up the debug menu, go to network - media,
type mp4 in the search box, look for the link that has .mp4 at the end, copy the link
and feed it into youtube-dl to download the video. (NOTE: for some reason i am only able to get a partial video to download and not the complete clip). if i use the add-on video download helper, i am able to grab the complete video.

@liamengland1
Copy link

@october262 stop leaving these comments. obviously OP knows how to download the video. he wants it added to youtube-dl.

@solonovamax
Copy link
Author

stop leaving these comments. obviously OP knows how to download the video. he wants it added to youtube-dl.

Yeah. It's almost trivially easy to download the video from it. It's just a simple cdn that you can just find from the network tab. And if it's multiple videos, I can just download them all and then combine them using ffmpeg. I just want to try and get this added so that it can help people in the future.

@wongyiuhang wongyiuhang linked a pull request Feb 1, 2021 that will close this issue
11 tasks
@wongyiuhang
Copy link

Would there be any password-protected video examples? If no, my code can only support public videos.🙈

https://support.loom.com/hc/en-us/articles/360002235698-How-to-protect-your-videos-with-a-password

@solonovamax
Copy link
Author

solonovamax commented Feb 1, 2021

I don't really have an enterprise account, so I can't make any dummy videos to test.

I'll search around a bit and post a comment if I find one you can test on.

Also, I believe it's possible to make playlists, as I found this: https://www.loom.com/share/folder/997db4db046f43e5912f10dc5f817b5c
So it seems you can make "folders" of videos that can contain more folders, videos, or both. So a simple tree structure.

Looking at dev tools, it seems to GET to https://www.loom.com/v1/folders/[FOLDER-ID]?content_type=folder&limit=10000 to get the list of folders/videos in the current folder.
It then seems to do a GET to https://www.loom.com/v1/folders/[FOLDER-ID]?content_type=video&limit=50&archived=false&all_videos=&include_pending=true to get a list of videos in the current folder.
Then, when to click on one of the nested folders it does this:

  • First, it grabs the id of the folder from the JSON object that was returned from the first GET to get the folders. It gets this from .folders[].id (using the syntax jq uses because idk what else to use lol)
  • It takes this id and then GETs to https://www.loom.com/v1/folders/[SUBFOLDER-ID]?content_type=folder&limit=10000, to list any nested folders (in the site I was using for testing, it didn't have any nested folder at this point, but I assume you'd just recurse through the folders)
  • it then sends a GET to https://www.loom.com/v1/folders/[SUBFOLDER-ID]/parents?root=[ROOT-FOLDER-ID] to get the name of the root folder. This step can probably™ be ignored.
  • then, like the folder above it, it GETs to https://www.loom.com/v1/folders/[SUBFOLDER-ID]?content_type=video&limit=50&archived=false&all_videos=&include_pending=true to get the videos in the current folder.

So, to get a list of all videos within the folder you'd go like this:

  • parse the folder id from the URL provided to youtube-dl.
  • Use that folder id to GET to https://www.loom.com/v1/folders/[FOLDER-ID]?content_type=folder&limit=10000 to get any sub folders.
  • For each sub folder, GET to https://www.loom.com/v1/folders/[FOLDER-ID]?content_type=folder&limit=10000 and add any subfolders you find to a list.
  • Repeat the above step until you cannot find any more folders.
  • Once you have a list of all the folders, loop through that list and GET to https://www.loom.com/v1/folders/[SUBFOLDER-ID]?content_type=video&limit=50&archived=false&all_videos=&include_pending=true to get all the videos.
  • Take the returned JSON of the videos, and just add each video id (located at .videos[].id) and then add them all to a list.
  • Pass all of the video ids to the code you already have and download each one. The video id from .videos[].id is the id used in the URL: https://www.loom.com/share/[VIDEO-ID]

Also, side note, I just noticed that when you record a video on loom it records a bunch of details about your computer and those are public LUL.
When I was sending requests to https://www.loom.com/v1/folders/[SUBFOLDER-ID]?content_type=video&limit=50&archived=false&all_videos=&include_pending=true, it was showing the host OS, the cpu name, the os version, how much memory they have, how much memory loom is using, what mic they're using, and a bunch of other weird shit....
Mental note: don't ever record videos on loom.

Also, this is funny
image

@wongyiuhang
Copy link

I have added folder support c9f3667 to the Pull Request #28039. Hopefully, it passes all CI Tests.

For requesting https://www.loom.com/v1/folders/[FOLDER-ID]?content_type=folder&limit=10000, I realised that I can simply GET https://www.loom.com/v1/folders/[FOLDER-ID]. The API would return both subfolders and videos within the same folder. That would save the user a few JSON requests.

Loom: Your videos are not searchable

Lol, they forgot to remind the user how to secure the video links.

@Fred-Vatin
Copy link

Fred-Vatin commented Feb 24, 2021

@wongyiuhang Could you test this url https://www.loom.com/share/0ae415e1035f4aec8207b7403c2563c5 please ? Does it download one file with no 403 error ?

@wongyiuhang
Copy link

wongyiuhang commented Feb 24, 2021

@wongyiuhang Could you test this url https://www.loom.com/share/0ae415e1035f4aec8207b7403c2563c5 please ? Does it download one file with no 403 error ?

I just tried your link. It provides two formats, octet-stream(raw-url) and mp4(transcoded-url). It is my first to realise Loom does provide octet-stream, therefore my code only downloads *.mpd file. However, the mp4 format can be downloaded successfully.

Additional notes:
octet-stream shall be working similar to hls, which each video segment download requires a token for authentication. The token can be found at part_credentials from POST https://www.loom.com/api/campaigns/sessions/[VIDEO-ID]/raw-url

@Fred-Vatin
Copy link

@wongyiuhang Thanks.

I hope your PR will be approved soon.

@RobbiNespu
Copy link

Looking forward for this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-support-request Add extractor(s) for a new domain
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants