Skip to content

Instantly share code, notes, and snippets.

@floscr
Last active June 22, 2017 07:49
Show Gist options
  • Save floscr/5a3b11a1be605d575c1a to your computer and use it in GitHub Desktop.
Save floscr/5a3b11a1be605d575c1a to your computer and use it in GitHub Desktop.
Download Vimcast Video Files
#!/bin/sh
# Downloads all vimcast videos & save a bookmark file in the same name
# Edit the number manually, have not found a way to get this automatically
for (( i = 1; i < 68; i++ )); do
FILE=$(curl -s http://media.vimcasts.org/videos/$i/ | grep m4v | sed 's/.*m4v\">\(.*m4v\)<\/a>.*/\1/g')
URL=http://media.vimcasts.org/videos/$i/$FILE
OUTPUT_VIDEO_FILE="0$i-$FILE"
OUTPUT_BOOKMARK_FILE="$OUTPUT_VIDEO_FILE.webloc"
echo "$URL"
if [[ ! -f "$OUTPUT_VIDEO_FILE" ]]; then
curl -C - -# -o $OUTPUT_VIDEO_FILE "$URL"
touch "$OUTPUT_BOOKMARK_FILE"
cat >"$OUTPUT_BOOKMARK_FILE" <<EOL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>http://vimcasts.org/episodes/$i/</string>
</dict>
</plist>
EOL
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment