Created
April 17, 2012 18:30
-
-
Save whiteley/2408031 to your computer and use it in GitHub Desktop.
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 | |
set -o errexit | |
set -o nounset | |
url='http://web.cecs.pdx.edu/~zeshan/ece341.htm' | |
filename='ece341' | |
extension='flv' | |
year='12' | |
rtmpserver='echo360.pdx.edu' | |
rtmpapp='echo/_definst_/' | |
# pull href content out of link | |
videos=( $(curl ${url} | grep echo360 | awk -F \" '{print $2}') ) | |
# loop through the lectures | |
for ((i=0;i<${#videos[@]};i++)); do | |
# class is on Tuesday and Thursday == 2 || 4 | |
day=$((2 + 2 * (${i} % 2))) | |
# term started week 14 | |
week=$((14 + (${i} / 2))) | |
# ece341##.flv | |
file="${filename}$(printf %02d ${i}).${extension}" | |
# grab the ugly hex directory name from the end of the url | |
dir=$(echo ${videos[${i}]} | awk -F / {'print $NF'}) | |
if [[ -f ${file} ]]; then | |
echo "${file} already downloaded" | |
else | |
# lecture #1 == 1214/2/df03063e-9dc6-4d64-bbe7-c71bd6ee9376/audio-video.flv | |
rtmpdump -r rtmp://${rtmpserver}/${rtmpapp} -a ${rtmpapp} -y ${year}${week}/${day}/${dir}/audio-video.flv -o ${file} | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment