Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Last active May 27, 2019 20:51
Show Gist options
  • Save manashmandal/c773d33e46881c1116d70c9437751d3c to your computer and use it in GitHub Desktop.
Save manashmandal/c773d33e46881c1116d70c9437751d3c to your computer and use it in GitHub Desktop.
Egghead Course Download Script
from lxml import html
import requests
import os
import json
from tqdm import tqdm
COURSES = """https://egghead.io/courses/cycle-js-fundamentals
https://egghead.io/courses/use-d3-v3-to-build-interactive-charts-with-javascript
https://egghead.io/courses/asynchronous-programming-the-end-of-the-loop
https://egghead.io/courses/react-native-fundamentals
https://egghead.io/courses/wrangle-your-terminal-with-tmux
https://egghead.io/courses/understand-javascript-arrays
https://egghead.io/courses/js-console-for-power-users
https://egghead.io/courses/getting-started-with-react-router-v3
https://egghead.io/courses/reduce-data-with-javascript-array-reduce
https://egghead.io/courses/build-interactive-javascript-charts-with-d3-v4
https://egghead.io/courses/using-chrome-developer-tools-elements
https://egghead.io/courses/chrome-devtools-sources-panel
https://egghead.io/courses/use-grep-for-fast-search-from-the-command-line
https://egghead.io/courses/build-a-react-native-todo-application
https://egghead.io/courses/natural-language-processing-in-javascript-with-natural
https://egghead.io/courses/learn-es6-ecmascript-2015
https://egghead.io/courses/animate-react-native-ui-elements
https://egghead.io/courses/build-your-first-production-quality-react-app
https://egghead.io/courses/building-react-applications-with-idiomatic-redux
https://egghead.io/courses/write-simple-asynchronous-code-with-javascript-generators
https://egghead.io/courses/style-an-application-from-start-to-finish
https://egghead.io/courses/build-a-graphql-server
https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript
https://egghead.io/courses/fundamentals-of-react-native-video
https://egghead.io/courses/build-a-react-app-with-redux
https://egghead.io/courses/build-react-components-from-streams-with-rxjs-and-recompose
https://egghead.io/courses/add-routing-to-react-apps-using-react-router-v4
https://egghead.io/courses/build-a-server-rendered-code-split-app-in-react-with-react-universal-component
https://egghead.io/courses/manage-application-state-with-mobx-state-tree
https://egghead.io/courses/optimistic-ui-updates-in-react
https://egghead.io/courses/understand-javascript-s-this-keyword-in-depth
https://egghead.io/courses/advanced-react-component-patterns
https://egghead.io/courses/progressive-web-apps-in-react-with-create-react-app
https://egghead.io/courses/build-a-neo4j-graphql-api
https://egghead.io/courses/json-web-token-jwt-authentication-with-node-js-and-auth0
https://egghead.io/courses/automate-daily-development-tasks-with-bash
https://egghead.io/courses/create-smooth-performant-transitions-with-react-transition-group-v2
https://egghead.io/courses/asynchronous-state-management-with-redux-observable-v1
https://egghead.io/courses/reusable-state-and-effects-with-react-hooks
https://egghead.io/courses/advanced-bash-automation-for-web-developers
https://egghead.io/courses/modern-javascript-tooling-with-react
https://egghead.io/courses/just-enough-functional-programming-in-javascript
https://egghead.io/courses/sql-fundamentals
https://egghead.io/courses/the-beginner-s-guide-to-react
https://egghead.io/courses/simplify-react-apps-with-react-hooks
https://egghead.io/courses/create-amazing-animations-with-greensock
https://egghead.io/courses/ssh-for-remote-server-authentication
https://egghead.io/courses/graphql-data-in-react-with-apollo-client
https://egghead.io/courses/react-context-for-state-management
https://egghead.io/courses/css-fundamentals
https://egghead.io/courses/building-serverless-web-applications-with-react-aws-amplify""".split('\n')
for course in tqdm(COURSES):
content = requests.get(course).content
tree = html.fromstring(content)
links = ['https://egghead.io' + link for link in tree.xpath("//h2[contains(@class, 'black ma0 mb1')]/../../@href")]
titles = tree.xpath("//h2[contains(@class, 'black ma0 mb1')]/text()")
course_data = dict(zip(titles, links))
course_name = course.split('/')[-1]
if not os.path.exists(course_name):
os.mkdir(course_name)
with open('{dd}/course_lessons.json'.format(dd=course_name), 'w') as jsonfile:
json.dump(course_data, jsonfile)
for l in links:
os.system("cd {dd} && youtube-dl {dl}".format(dl=l, dd=course_name))
@manashmandal
Copy link
Author

Requirements

pip3 install --user tqdm requests lxml

sudo apt-get install -y youtube-dl

@KantaPaul
Copy link

vai ei code use korbo kivabe please help me

@ArRolin
Copy link

ArRolin commented May 24, 2019

#For Windows User:

add this in your path variable
%USERPROFILE%\AppData\Roaming\Python\Python37\Scripts

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