Skip to content

Instantly share code, notes, and snippets.

@hazkaz
Created Jun 29, 2018
Embed
What would you like to do?
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