Skip to content

Instantly share code, notes, and snippets.

@dnlmengs
Last active February 23, 2017 10:28
Show Gist options
  • Save dnlmengs/9e11670e1be38b005634450b972a022f to your computer and use it in GitHub Desktop.
Save dnlmengs/9e11670e1be38b005634450b972a022f to your computer and use it in GitHub Desktop.
Things like this happen. Only working until vimeo changes the way it gets the video files again.
#!/bin/sh
if [ $# -ne 2 ]; then
echo "Usage: $0 vimeo_id filename"
exit 1
fi
# Set the user agent ID to use
USER_AGENT="Mozilla/5.0"
GET="wget -U '${USER_AGENT}' -q -O -"
# Get the json
JSON=`$GET http://vimeo.com/${1} |grep https://player.vimeo.com/video/${1}/config |perl -p -e 's/^.*e\.open\("GET","(https:\/\/player.vimeo.com\/video\/.+\/config.+?)".*$/$1/'`
URL=`$GET $JSON |perl -p -e 's/^.*"profile".*width":720.*?"url":"(.*?\?token.*?)".*$/$1/'`
# Get the video
$GET $URL > $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment