Created
June 29, 2018 10:21
-
-
Save hazkaz/49d36b1ccc123f7117cfae67f5e62a42 to your computer and use it in GitHub Desktop.
Bash Script to download egghead pro videos using their rss feed
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 | |
#usage ./egghead.sh 'rss-url-in-single-quotes' (I don't know why the single quotes are needed, but it doesn't work without) | |
#requirements - youtube-dl should be installed and available in your path | |
#curl is also needed | |
#results - a folder with the coursename will be created where the script is executed with the videos numbered sequentially | |
#let me know if you have suggestions for improvement | |
coursename=$(echo $1|egrep -oe 'courses/([^/]*)' | cut -d"/" -f2) | |
curl "$1" -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' > $coursename.rss || echo "acquired rss summary" | |
echo "parsing links from rss feed..." | |
cat $coursename.rss | egrep -o -e "enclosure url=\"([^( )]*?)" | sed -e "s/\&/\&/g" | sed -e "s/enclosure url=//" | sed -e "s/\"//g" > $coursename.links | |
echo "links parsed" | |
echo "Starting Download" | |
iter=1; | |
for i in $(cat $coursename.links); | |
do | |
val=$(cut -d'.' -f1<<<$coursename.links) | |
youtube-dl -o "$val/$iter.%(title)s.%(ext)s" $i | |
let iter=${iter}+1; | |
done || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment