-
-
Save xiaogh98/2f2f6bb37409404dfe5b14c529acc95a to your computer and use it in GitHub Desktop.
Download Vimcast Video Files
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/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