Created
May 21, 2025 22:08
-
-
Save cmj/9e35bf39cfc1f46cee5e3e7a0b5311ca to your computer and use it in GitHub Desktop.
Fast, no authentication method to download Twitter videos
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 | |
# 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