Created
April 3, 2017 01:55
-
-
Save strycore/8ee36dbadc23abd1e1946618be6a7e97 to your computer and use it in GitHub Desktop.
Download the videos from Egghead.io Redux courses
This file contains 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
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