斯坦福大学有几门计算机、电子工程相关的公开课,包括教学视频和课程资料,供免费下载。官网链接,首页预览如下:
如果一个一个去下载,挺麻烦的,写了个python
脚本,目前依赖于Linux
的wget
和mkdir
(mingw
我没试过),如果你正在找类似资源,希望能帮到你。
from subprocess import call
import re #正则表达式
baseUrl = "http://html5.stanford.edu/videos/courses/see/"
courseSeries = 9 #开通的课程总数
courseList = [dict() for x in range(courseSeries)]
# Introduction to Computer Science
courseList[0] = ["CS106A",28,"Programming Methodology","Sahami, Mehran","https://see.stanford.edu/materials/icspmcs106a/ProgrammingMethodologyAllMaterials.zip"]
courseList[1] = ["CS106B",27,"Programming Abstractions","Zelenski, Julie","https://see.stanford.edu/materials/icspacs106b/ProgrammingAbstractionsAllMaterials.zip"]
courseList[2] = ["CS107",27,"Programming Paradigms","Cain, Jerry","https://see.stanford.edu/materials/icsppcs107/ProgrammingParadigmsAllMaterials.zip"]
# Artificial Intelligence
courseList[3] = ["CS223A",16,"Introduction to Robotics","Khatib, Oussama","https://see.stanford.edu/materials/aiircs223a/IntroToRoboticsAllMaterials.zip"]
courseList[4] = ["CS229",20,"Machine Learning","Ng, Andrew","https://see.stanford.edu/materials/aimlcs229/MachineLearningAllMaterials.zip"]
# Linear Systems and Optimization
courseList[5] = ["EE261",30,"The Fourier Transform and its Applications","Osgood, Brad G","https://see.stanford.edu/materials/lsoftaee261/FourierTransformAllMaterials.zip"]
courseList[6] = ["EE263",20,"Introduction to Linear Dynamical Systems","Boyd, Stephen","https://see.stanford.edu/materials/lsoeldsee263/LinearDynamicalSystemsAllMaterials.zip"]
courseList[7] = ["EE364A",19,"Convex Optimization I","Boyd, Stephen","https://see.stanford.edu/materials/lsocoee364a/ConvexOptimizationIAllMaterials.zip"]
courseList[8] = ["EE364B",18,"Convex Optimization II","Boyd, Stephen","https://see.stanford.edu/materials/lsocoee364b/ConvexOptimizationIIAllMaterials.zip"]
def downloadCourse(courseName,courseTotal):
courseMain = baseUrl + courseName + "/" + courseName + "-lecture"
videoFormat = ".mp4"
#新建一个路径
call(["mkdir",courseName])
for c in range(1,courseTotal+1):
if c < 10:
index = "0"
index = index + str(c)
else:
index = str(c)
link = courseMain + index + videoFormat
print(link)
#下载并保存到对应路径
call(["wget","-P",courseName,link])
#视频资源下载结束后,解析出课程附件
for i in range(courseSeries):
search = re.search(courseName,courseList[i][4],re.IGNORECASE)
if search:
call(["wget","-P",courseName,(courseList[i][4])])
#下载第一门课程
downloadCourse(courseList[0][0],courseList[0][1])