Last active
May 12, 2025 12:00
-
-
Save krasi-georgiev/afb8fce8d05dbe601545d514f080c095 to your computer and use it in GitHub Desktop.
tldv.io download
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Make sure the meeting is public to avoid needing authentication. | |
# Run directly with: | |
# bash <(curl -s https://gist.githubusercontent.com/krasi-georgiev/afb8fce8d05dbe601545d514f080c095/raw/tldv.sh) | |
# === Dependency check === | |
for cmd in jq ffmpeg; do | |
if ! command -v $cmd >/dev/null 2>&1; then | |
echo "β Required command '$cmd' is not installed." | |
echo "π Install it with: brew install $cmd (on macOS) or apt install $cmd (on Linux)" | |
exit 1 | |
fi | |
done | |
# === Prompt for Meeting ID === | |
read -p "Paste the TLDV Meeting ID: " MEETING_ID | |
# === Fetch metadata === | |
MEETING_JSON=$(curl -s "https://gw.tldv.io/v1/meetings/$MEETING_ID/watch-page?noTranscript=true") | |
# === Extract video URL safely === | |
VIDEO_URL=$(echo "$MEETING_JSON" | jq -r ' | |
if .meeting.video.source != null and .meeting.video.source != "null" | |
then .meeting.video.source | |
elif .video.source != null and .video.source != "null" | |
then .video.source | |
else empty | |
end | |
') | |
# === Check for error or missing video URL === | |
if [[ -z "$VIDEO_URL" ]]; then | |
echo "β No video URL found. This meeting might not be public or returned invalid data." | |
echo -e "\nπ Full API response:" | |
echo "--------------------------" | |
echo "$MEETING_JSON" | |
echo "--------------------------" | |
exit 1 | |
fi | |
# === Set output filename === | |
OUTPUT_FILE="${MEETING_ID}.mp4" | |
# === Download === | |
echo "π₯ Downloading from: $VIDEO_URL" | |
echo "πΎ Saving as: $OUTPUT_FILE" | |
ffmpeg -i "$VIDEO_URL" -c copy "$OUTPUT_FILE" | |
echo "β Download complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment