Skip to content

Instantly share code, notes, and snippets.

@cmj
Created May 21, 2025 22:08
Show Gist options
  • Save cmj/9e35bf39cfc1f46cee5e3e7a0b5311ca to your computer and use it in GitHub Desktop.
Save cmj/9e35bf39cfc1f46cee5e3e7a0b5311ca to your computer and use it in GitHub Desktop.
Fast, no authentication method to download Twitter videos
#!/bin/bash
# Fast, no authentication method to download Twitter videos
id=$1
curl -s "https://cdn.syndication.twimg.com/tweet-result?id=${id##*/}&lang=en&token=0" |
jq -r '"\(.id_str) \(.user.screen_name) \(if(.mediaDetails[0].video_info.variants[-1].url) then .mediaDetails[0].video_info.variants[-1].url elif(.video.variants[-1].src) then .video.variants[-1].src else null end)"' |
while read id user url; do
if [[ "$url" == "null" ]]; then
echo "Video not found"
exit 1
else
wget -nc -O "${user}-${id}.mp4" "${url}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment