Skip to content

Instantly share code, notes, and snippets.

@strycore
Created April 3, 2017 01:55
Show Gist options
  • Save strycore/8ee36dbadc23abd1e1946618be6a7e97 to your computer and use it in GitHub Desktop.
Save strycore/8ee36dbadc23abd1e1946618be6a7e97 to your computer and use it in GitHub Desktop.
Download the videos from Egghead.io Redux courses
import requests
import subprocess
from urllib.parse import urlparse
from bs4 import BeautifulSoup
main_url = "https://egghead.io/courses/getting-started-with-redux"
response = requests.get(main_url)
soup = BeautifulSoup(response.content, 'html.parser')
links = soup.select('.lesson-row .cell-lesson-title a')
for index, link in enumerate(links):
url = link['href']
parsed_url = urlparse(url)
filename = "{:02d}-{}.mp4".format(index + 1, parsed_url.path.split('/')[-1])
subprocess.Popen(['youtube-dl', url, '-o', filename]).communicate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment