Skip to content

Instantly share code, notes, and snippets.

@mnsami
Last active August 4, 2022 06:27
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save mnsami/3ab653bb8cd8621c5847ff63fe0c15d7 to your computer and use it in GitHub Desktop.
Save mnsami/3ab653bb8cd8621c5847ff63fe0c15d7 to your computer and use it in GitHub Desktop.
this script is to download egghead videos using youtube-dl

1. Requirements

In order for the bash script to work. you need to have youtube-dl installed on your system from here youtube-dl

2. Installation

2.1. Mac osx

You need the GNU version of getopt for this script to run.

2.1.1. Get GNU version of getopt:
brew install gnu-getopt
brew link --force gnu-getopt
2.1.2. Make it executable
chmod a+x download_egghead_videos.sh

2.2. Linux

2.2.1. Make it executable
chmod a+x download_egghead_videos.sh

3. Usage

usage: --coursename [--coursename "build-a-react-app-with-redux"] --type [--type "courses|lessons"]
3.1. Arguments

-c | --coursename: required parameter to supply the course name extracted from the url, i.e. https://egghead.io/courses/get-started-with-elasticsearch the --coursename would be 'get-started-with-elasticsearch'

-t | --type: required parameter to specify the type, either courses or lessons, extracted from the url as well.

Example

./download_egghead_videos.sh --coursename "build-virtual-reality-experiences-using-react-vr" --type "courses"
#!/bin/bash
usage() { echo "usage: --coursename [--coursename \"build-a-react-app-with-redux\"] --type [--type \"courses|lessons\"]" 1>&2; exit 1; }
OPTS=$(getopt -o c:t: --long coursename:,type: -n 'download_egghead_videos.sh' -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$OPTS"
COURSENAME=""
TYPE=""
while true ; do
case "$1" in
-c | --coursename) COURSENAME="$2"; shift 2 ;;
-t | --type) TYPE="$2"; shift 2 ;;
-- ) shift; break ;;
* ) usage ;;
esac
done
if [ -z "${COURSENAME}" ] || [ -z "${TYPE}" ]; then
usage
fi
youtube-dl --download-archive "$COURSENAME/archive.txt" -o "$COURSENAME/%(playlist_index)s_%(title)s" "https://egghead.io/$TYPE/$COURSENAME"
@fipo
Copy link

fipo commented Dec 9, 2017

Works awesome, thanks ;)
maybe you should add brew install ffmpeg ;)

@vativa
Copy link

vativa commented Jan 23, 2018

ERROR: Unable to download JSON metadata: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)'),))

@Ahed91
Copy link

Ahed91 commented Oct 19, 2018

OMG!, it Works
Thanks

@bgadiel
Copy link

bgadiel commented Dec 10, 2018

ERROR: Unable to download JSON metadata: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)'),))

@dipencc
Copy link

dipencc commented Jun 23, 2021

ERROR: Unable to download JSON metadata: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

./download_egghead_videos.sh --coursename "fundamentals-of-redux-course-from-dan-abramov-bd5cc867" --type "courses"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment