Skip to content

Instantly share code, notes, and snippets.

@AlessandroVaccarino
Created June 28, 2024 07:14
Show Gist options
  • Save AlessandroVaccarino/fe868774394cc0342351ed98c715d122 to your computer and use it in GitHub Desktop.
Save AlessandroVaccarino/fe868774394cc0342351ed98c715d122 to your computer and use it in GitHub Desktop.
Simple Python scripts that, starting from a Loom video link, downloads it locally
#!/usr/bin/python3
import requests
url="https://www.loom.com/share/..."
def extract_id_from_url(url):
urlRet = url.split("/")[-1]
if '?' in urlRet:
urlRet = urlRet.split("?")[0]
return urlRet
def fetch_loom_download_url(id):
response = requests.post(url=f"https://www.loom.com/api/campaigns/sessions/{id}/transcoded-url")
if response.status_code == 200:
return response.json()["url"]
else:
print("Error while retrieving response: ", response.status_code)
exit
def download_loom_video(url, filename):
response = requests.get(url)
open(filename,"wb").write(response.content)
id = extract_id_from_url(url)
outputFilename = f"LoomVideo_{id}.mp4"
url = fetch_loom_download_url(id)
download_loom_video(url, outputFilename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment