Tumblr Video Downloader
There were multiple occasions that I needed to download a video clip hosted on Tumblr and got lazy digging through the page-source for the file location.
So, to solve this trouble once-and-for-all, I whipped up a simple bash script that takes a single URL argument and it’ll download the video clip into the current directory.
It’s really simple and dirty and I hope you might find it useful.
#!/usr/bin/env bash # # This scripts searches for a video_file link from the a Tumblr # video premalink page and uses wget to download the video file. # # Requirements: curl, 7.21.2 or newer. # if [ -z "$1" ]; then echo "Usage: $0 <tumblr permalink URL>" exit 1 fi set -e set -o pipefail URL=`curl -s -S -L "$1" | grep -i "video_file" | tr ' ' '\n' | grep -i video_file | sed 's|\\\\x22||g' | sed 's|^src=||g' ` echo "$URL" set -x #wget --content-disposition -c "$URL" curl -L -C - -J -O "$URL"
It requires a recent version of curl.
Update: By popular demand, here’s a web-based version.