php 抓取网易公开课视频下载链接
抓取网易公开课视频下载链接 批量抓取网易公开课课程列表页面的视频下载链接,依赖BeautifulSoup链接地址作为参数传入程序,使用方法如下:命令行中运行:python xx.python http://v.163.co
批量抓取网易公开课课程列表页面的视频下载链接,依赖BeautifulSoup
链接地址作为参数传入程序,使用方法如下:
命令行中运行:python xx.python http://v.163.com/special/opencourse/buildingdynamicweb sites.html(课程列表地址),视频下载地址批量输出,通过迅雷等软件批量下载视频
import urllib from bs4 import BeautifulSoup import fnmatch import sys if __name__ == '__main__': url = sys.argv[1] html = urllib.urlopen(url).read() soup = BeautifulSoup(html) for link in soup.find_all('a'): content = link.get('href') if type(content)==type(None): pass elif fnmatch.fnmatch(content, "*.mp4"): print content else: pass //该片段来自于http://outofmemory.cn
精彩图集
精彩文章