Skip to content

Instantly share code, notes, and snippets.

@akash-gajjar
Last active April 21, 2025 10:50
Show Gist options
  • Save akash-gajjar/24fc183f6b25c74750606606f2319d01 to your computer and use it in GitHub Desktop.
Save akash-gajjar/24fc183f6b25c74750606606f2319d01 to your computer and use it in GitHub Desktop.
Download videos from TLDV.io
from datetime import datetime
from os import system
import requests
import json
## Please install ffmpeg before running this script and make sure it's in your PATH
## brew install ffmpeg
## Please install requests before running this script
## pip3 install requests
## download video from tldv.io
##
## 1. Go to https://tldv.io/
## 2. Login
## 3. Go to the meeting you want to download
## 4. Copy the URL of the meeting
## 5. Open the developer tools (F12)
## 6. Go to the network tab
## 7. Refresh the page
## 8. Find the request to https://gw.tldv.io/v1/meetings/64145828ced74b0013d496ce/watch-page?noTranscript=true
## 9. Copy the auth token from the request headers
## 10. Run this script and paste the URL and auth token
## 11. python3 tldv.py
url = input("Please paste the URL of the meeting you want to download: ")
meeting_id = url.split("/")[-1]
print("\rFound meeting ID: ", meeting_id)
auth_token = input("Auth token: ")
data = requests.get(
f"https://gw.tldv.io/v1/meetings/{meeting_id}/watch-page?noTranscript=true",
headers={
"Authorization": auth_token,
},
)
try:
response = json.loads(data.text)
meeting = response.get("meeting", {})
name = meeting.get("name", "No name")
createdAt = meeting.get("createdAt", datetime.now())
source = response.get("video", {}).get("source", None)
date = datetime.strptime((createdAt), "%Y-%m-%dT%H:%M:%S.%fZ")
normalised_date = date.strftime("%Y-%m-%d-%H-%M-%S")
filename = f"{normalised_date}_{name}"
filename_ext = ".mp4"
command = f'ffmpeg -i {source} -c copy "{filename}.{filename_ext}"'
json_filename = f'{filename}.json'
with open(json_filename, "w") as f:
f.write(data.text)
print(command)
print("Downloading video...")
system(command)
except:
print("Error encountered")
print(data.text)
@Juniornam
Copy link

it's not clear on how to get the authorization token

@Juniornam
Copy link

I think I found the token, but it gives me an error unauthorized message

@Olufemi-ca
Copy link

Hi I'm not a dev but i need to download a video from tldv

I got lost at 8, I couldn't find the request

could you help out

@Juniornam
Copy link

same i also got lost at step 8

@neelmalgo
Copy link

neelmalgo commented May 16, 2024

For step 8, search "auth" under the filter. The requests will be sorted and the auth request will be seen.
image
Copy the authorization including bearer.

@neelmalgo
Copy link

@foya10
Copy link

foya10 commented Jul 18, 2024

not works !!

@cnovasj
Copy link

cnovasj commented Jul 29, 2024

I created a fork with working code

@alexandrembf
Copy link

@cnovasj can you share with us?

@KD-MM2
Copy link

KD-MM2 commented Dec 6, 2024

Thanks. It's works.

@KD-MM2
Copy link

KD-MM2 commented Dec 6, 2024

I have forked one with some changes:

  • Remove invalid characters from the filename
  • Add "Bearer" to auth token if not present

@bista-alpeshvalaki
Copy link

its stoped working from today

@LucJager
Copy link

LucJager commented Jan 7, 2025

Does anyone have a new working version ?

@kordero
Copy link

kordero commented Jan 29, 2025

thanks! works like a charm!

@Fabiano-Couto
Copy link

Anyone could download from MACOS? I have tried but it doesn't work. I am able to enter the url and the token but it seems to show me on terminal, all transcription of the video but does not download the video or anything.

@javier-ortizt
Copy link

Works like a charm!
I added a fork with parallel downloading in case you need to download and process multiple at a time.
I obtained links with selenium, and then made a list of videos. The MAX_WORKERS are basically the number of parallel videos to download and process. This makes the process way much faster.

@tejas-mn
Copy link

tejas-mn commented Apr 12, 2025

Awesome works!

Steps:
Download fmpeg: https://www.youtube.com/watch?v=JR36oH35Fgg
Run the python script and it asks for url and token
Copy the tldv shared meeting link
Make sure the url at end doesn't have / after the meeting id
Take the authorization token as said above
Paste it and enter
ffmpeg starts downloadig... each bytes of video and saves as mp4 at the end

@MarceauGiraud
Copy link

For people on Mac OS, I have added a Fork that works perfectly.
There was an issue in the name of the file created. It has an unsupported name due to '/'.

@MarceauGiraud
Copy link

Anyone could download from MACOS? I have tried but it doesn't work. I am able to enter the url and the token but it seems to show me on terminal, all transcription of the video but does not download the video or anything.

Check my fork, it works on MacOS

@HugioFive
Copy link

Si desconozco todo lo que menciona porque no soy ingeniero de sistemas o relacionado. Deberia aplicar esto en mi laptop. me recomiendan algun tema en particular para aprender mas de esto por favor. se me van a borrar esos videos en 2 semanas y los necesito pero no puedo pagar el premium

@nivvyx
Copy link

nivvyx commented Apr 20, 2025

import os
import re
import json
import requests
from datetime import datetime
from subprocess import run, CalledProcessError
from tqdm import tqdm
#open cmd and type pip3 install requests tqdm

--- Helper Functions ---

def sanitize_filename(name):
return re.sub(r'[\/*?:"<>|]', "_", name)

def get_meeting_id(url):
return url.rstrip("/").split("/")[-1]

def fetch_meeting_data(meeting_id, auth_token):
api_url = f"https://gw.tldv.io/v1/meetings/{meeting_id}/watch-page?noTranscript=true"
response = requests.get(api_url, headers={"Authorization": auth_token})
response.raise_for_status()
return response.json()

def download_video(source_url, output_file):
command = [
"ffmpeg",
"-i", source_url,
"-c", "copy",
output_file
]
try:
run(command, check=True)
print(f"\nβœ… Download completed: {output_file}")
except CalledProcessError as e:
print("\n❌ Error during download.")
print(e)

--- Main Logic ---

def main():
print("πŸ“₯ TLDV Video Downloader")

url = input("Paste the full TLDV meeting URL: ").strip()
if not url:
    print("⚠️  URL cannot be empty.")
    return

auth_token = input("Paste your auth token: ").strip()
if not auth_token:
    print("⚠️  Auth token is required.")
    return

meeting_id = get_meeting_id(url)
print(f"πŸ” Found Meeting ID: {meeting_id}")

try:
    data = fetch_meeting_data(meeting_id, auth_token)
except requests.exceptions.HTTPError as err:
    print(f"❌ Failed to fetch meeting data: {err}")
    return

meeting = data.get("meeting", {})
name = sanitize_filename(meeting.get("name", "TLDV_Meeting"))
created_at = meeting.get("createdAt", datetime.now().isoformat())

try:
    date_obj = datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%S.%fZ")
except ValueError:
    date_obj = datetime.now()

timestamp = date_obj.strftime("%Y-%m-%d-%H-%M-%S")
output_filename = f"{timestamp}_{name}.mp4"

source_url = data.get("video", {}).get("source")
if not source_url:
    print("❌ Video source not found.")
    return

print(f"\n🎬 Title: {name}")
print(f"πŸ“… Created At: {timestamp}")
print(f"🎯 Output File: {output_filename}")

confirm = input("\nProceed with download? (y/n): ").strip().lower()
if confirm != 'y':
    print("❌ Download canceled.")
    return

json_backup = f"{timestamp}_{name}.json"
with open(json_backup, "w") as f:
    json.dump(data, f, indent=2)
    print(f"πŸ“ Metadata saved to {json_backup}")

print("⏬ Downloading video...")
download_video(source_url, output_filename)

--- Run ---

if name == "main":
main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment