Skip to content

Instantly share code, notes, and snippets.

@hazkaz
Created June 29, 2018 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazkaz/49d36b1ccc123f7117cfae67f5e62a42 to your computer and use it in GitHub Desktop.
Save hazkaz/49d36b1ccc123f7117cfae67f5e62a42 to your computer and use it in GitHub Desktop.
Bash Script to download egghead pro videos using their rss feed
#! /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