
中国社会科学院大学《网络爬虫与数据采集》课程大纲课程基本信息(CourseInformation)*学时*学分课程编号482(CourseID)(Credit Hours)(Credits)网络爬虫与数据采集*课程名称(CourseName)Webcrawler anddata collection先修课程(Prerequisite Courses)在信息时代,以几何级数增加的数据形成了海量数据集,如何从这些数据中寻找有价值的信息就变得十分重要,大数据及数据分析技术已经成为信息技术中十分重要的一个环节。随着互联网+的不断发展,在所有行业中,数据分析技术都能发挥一定作用。中国特色社会主义进入新时代,实现中华民族伟大复兴的中国梦开启新征程。党中央决定实施国家大数据战略,吹响了加快发展数字经济、建设数字中国的号角。习近平总书记在十九届中共中央政治局第二次集体学习时的重要讲话中指出:“大数据是信息化发展的新阶段”,并做出了“推动大数据技术产业创新发展、构建以数据为关键要素的数字经济、运用大数据提升国家治理现代化水平、运用大数据促进保障和改善民生、切实保障国家数据安全”的战略部署,为我国构筑大数据时代国家综合竞争新优势指明了方向。*课程简介近年来,在互联网向智能时代迈进的过程中,数据发挥了巨大的推动作用。互联网每天都会产(Description)生大量数据,人们已经认识到蕴含在这些数据中的巨大价值,要想充分利用数据首先就需要获取数据。网络肥虫就是从互联网中获取数据的主要手段之一,Python爬虫框架Scrapy简单易用、灵活易拓展、文档丰富、开发社区活跃,使用Scrapy可以高效地开发网络爬虫应用。《Python网络爬虫》这门课程旨在让同学们了解网络爬虫的工作原理以及使用Scrapy爬虫框架从网络中获取数据,课程详细深入地介绍了Python流行框架Scrapy的核心技术及网络爬虫的开发技巧。课程从逻辑上可分为基础篇和进阶部分,基础部分重点介绍Scrapy的核心元素,如spider、selector、item、link等:进阶部分讲解爬虫的高级话题,如登录认证、文件下载、执行JavaScript、动态网页爬取、使用HTTP代理等,并配合项目案例讲解。《Python网络爬虫》很适合有一定Python语言基础,想学习编写复杂网络爬虫的学生选修。In the information age, massive data sets are formed by geometrically increasing data.It isveryimportant tofind valuable information fromthesedata.Big dataanddataanalysistechnologyhavebecomeaveryimportantpartofinformationtechnology.Withthecontinuous developmentof Internet+,dataanalysistechnology can playa certain role inall industries.Socialism with Chinese characteristics has entered a newera,and a newjourneyhasbeguntorealizetheChinesedreamofthegreatrejuvenationoftheChinesenation.TheParty Central Committeedecidedto implement the national bigdatastrategy*课程简介sounding the clarion call to accelerate the development of the digital economy and build(Description)a digital China.General SecretaryXi Jinping pointed out in his important speech at thesecond collective study of the Political Bureau of the 19th CPC Central Committee:"Bigdata isanewstageof informatizationdevelopment",andmade"promoting theinnovation and development of the big data technology industry,building a The strategicdeployment ofthedigital economywithdataas thekeyelement,theuseofbigdatatoimprovethe modernizationlevel of nationalgovernance, theuse of bigdata to promotetheprotection and improvementofpeople's livelihood,and the effectiveprotection ofnationaldatasecurityhaspointed outthedirectionformycountrytobuildanewnational
中国社会科学院大学《网络爬虫与数据采集》课程大纲 课程基本信息(Course Information) 课程编号 (Course ID) *学时 (Credit Hours) 48 *学分 (Credits) 2 *课程名称 (Course Name) 网络爬虫与数据采集 Web crawler and data collection 先修课程 (Prerequisite Courses) *课程简介 (Description) 在信息时代,以几何级数增加的数据形成了海量数据集,如何从这些数据中寻找有价值的信息 就变得十分重要,大数据及数据分析技术已经成为信息技术中十分重要的一个环节。随着互联网+ 的不断发展,在所有行业中,数据分析技术都能发挥一定作用。中国特色社会主义进入新时代,实 现中华民族伟大复兴的中国梦开启新征程。党中央决定实施国家大数据战略,吹响了加快发展数字 经济、建设数字中国的号角。习近平总书记在十九届中共中央政治局第二次集体学习时的重要讲话 中指出:“大数据是信息化发展的新阶段”,并做出了“推动大数据技术产业创新发展、构建以数据 为关键要素的数字经济、运用大数据提升国家治理现代化水平、运用大数据促进保障和改善民生、 切实保障国家数据安全”的战略部署,为我国构筑大数据时代国家综合竞争新优势指明了方向。 近年来,在互联网向智能时代迈进的过程中,数据发挥了巨大的推动作用。互联网每天都会产 生大量数据,人们已经认识到蕴含在这些数据中的巨大价值,要想充分利用数据首先就需要获取数 据。网络爬虫就是从互联网中获取数据的主要手段之一,Python 爬虫框架 Scrapy 简单易用、灵活 易拓展、文档丰富、开发社区活跃,使用 Scrapy 可以高效地开发网络爬虫应用。 《Python 网络爬虫》这门课程旨在让同学们了解网络爬虫的工作原理以及使用 Scrapy 爬虫框 架从网络中获取数据,课程详细深入地介绍了 Python 流行框架 Scrapy 的核心技术及网络爬虫的开 发技巧。课程从逻辑上可分为基础篇和进阶部分,基础部分重点介绍 Scrapy 的核心元素,如 spider、 selector、item、link 等;进阶部分讲解爬虫的高级话题,如登录认证、文件下载、执行 JavaScript、 动态网页爬取、使用 HTTP 代理等,并配合项目案例讲解。《Python 网络爬虫》很适合有一定 Python 语言基础,想学习编写复杂网络爬虫的学生选修。 *课程简介 (Description) In the information age, massive data sets are formed by geometrically increasing data. It is very important to find valuable information from these data. Big data and data analysis technology have become a very important part of information technology. With the continuous development of Internet+, data analysis technology can play a certain role in all industries. Socialism with Chinese characteristics has entered a new era, and a new journey has begun to realize the Chinese dream of the great rejuvenation of the Chinese nation. The Party Central Committee decided to implement the national big data strategy, sounding the clarion call to accelerate the development of the digital economy and build a digital China. General Secretary Xi Jinping pointed out in his important speech at the second collective study of the Political Bureau of the 19th CPC Central Committee: "Big data is a new stage of informatization development", and made "promoting the innovation and development of the big data technology industry, building a The strategic deployment of the digital economy with data as the key element, the use of big data to improve the modernization level of national governance, the use of big data to promote the protection and improvement of people's livelihood, and the effective protection of national data security has pointed out the direction for my country to build a new national

comprehensive competitiveadvantage in theera of big data.Inrecent years, data has playedahuge role inpromoting the Internettothe era ofintelligence.The Internetgenerates a largeamount of data everyday,and people haverealized the great value contained in this data. To make fulluse of the data, it is necessaryto acquire the data first. Web crawler is one of the main means to obtain data from theInternet.ThePython crawlerframework Scrapyis easytouse,flexibleandeasyto expand,rich indocumentation,and activeinthedevelopmentcommunity.Using Scrapycanefficientlydevelopweb crawlerapplications.The course"Python Web Crawler"aims to let students understand the working principleofwebcrawlersandusetheScrapycrawlerframeworktoobtaindatafromthenetwork.The course introduces indetail thecoretechnologyof thepopularPythonframeworkScrapyandthedevelopment skills of web crawlers.Thecoursecanbelogicallydividedintobasicpartsandadvancedparts.Thebasicpart focuses onthecoreelements ofScrapy,suchas spider,selector,item,link,etc.;theadvanced part explainstheadvancedtopicsofcrawlers,suchasloginauthentication,filedownload,execution JavaScript,dynamic web crawling,using HTTP proxy,etc.,andexplain with the project case."PythonWeb Crawler"is very suitable for students who have a certain Python languagefoundationand wanttolearn towritecomplexweb crawlers.*教材《精通Scrapy网络爬虫》,作者:刘硕出版社:清华大学出版社出版时间:2017年10月,版次1,(Textbooks)国际标准书号ISBN:9787302484936。参考资料(OtherReferences)*课程类别口公共基础课/全校公共必修课v通识教育课专业基础课(CourseCategory)口专业核心课/专业必修课口专业拓展课/专业选修课口其他口线上,教学平台*授课对象*授课模式全校本科生v线下口混合式口其他(TargetStudents)(Modeof Instruction)口实践类(70%以上学时深入基层)v中文*开课院系*授课语言口全外语计算机教研部(School)口双语:中文+(Languageof Instruction)(外语讲授不低于50%)课程负责人徐卫克,1980年生,男,中国社会科学院大学计算机教研部教师,计姓名及简介算社会科学研究中心成员,主要研究方向为数据分析、人工智能。教*授课教师信息(Teacher Information)团队成员无姓名及简介
comprehensive competitive advantage in the era of big data. . In recent years, data has played a huge role in promoting the Internet to the era of intelligence. The Internet generates a large amount of data every day, and people have realized the great value contained in this data. To make full use of the data, it is necessary to acquire the data first. Web crawler is one of the main means to obtain data from the Internet. The Python crawler framework Scrapy is easy to use, flexible and easy to expand, rich in documentation, and active in the development community. Using Scrapy can efficiently develop web crawler applications. The course "Python Web Crawler" aims to let students understand the working principle of web crawlers and use the Scrapy crawler framework to obtain data from the network. The course introduces in detail the core technology of the popular Python framework Scrapy and the development skills of web crawlers. The course can be logically divided into basic parts and advanced parts. The basic part focuses on the core elements of Scrapy, such as spider, selector, item, link, etc.; the advanced part explains the advanced topics of crawlers, such as login authentication, file download, execution JavaScript, dynamic web crawling, using HTTP proxy, etc., and explain with the project case. "Python Web Crawler" is very suitable for students who have a certain Python language foundation and want to learn to write complex web crawlers. *教材 (Textbooks) 《精通 Scrapy 网络爬虫》,作者: 刘硕 出版社: 清华大学出版社 出版时间:2017 年 10 月,版次 1, 国际标准书号 ISBN:9787302484936。 参考资料 (Other References) *课程类别 (Course Category) 公共基础课/全校公共必修课 √通识教育课 专业基础课 专业核心课/专业必修课 专业拓展课/专业选修课 其他 *授课对象 (Target Students) 全校本科生 *授课模式 (Mode of Instruction) 线上,教学平台 √线下 混合式 其他 实践类(70%以上学时深入基层) *开课院系 (School) 计算机教研部 *授课语言 (Language of Instruction) √中文 全外语 双语:中文+ (外语讲授不低于 50%) *授课教师信息 (Teacher Information) 课程负责人 姓名及简介 徐卫克,1980 年生,男,中国社会科学院大学计算机教研部教师,计 算社会科学研究中心成员,主要研究方向为数据分析、人工智能。教 授课程有《大学计算机》、《Python 数据分析》、《Python 深度学习》、 团队成员 姓名及简介 无

1.了解Scrapy框架结构及工作原理;2. 掌握WebScraper插件;3.熟悉Spider开发流程;使用Selector提取数据:4.学习目标使用Item封装数据;5.(Learning6.使用ItemPipeline处理数据;Outcomes)7.使用LinkExtractor提取链接;使用Exporter导出数据;8.9.掌握下载文件和图片;10.掌握爬取动态页面。*考核方式平时成绩30%,期末成绩70%(Grading)*课程教学计划(TeachingPlan)其中周教学内容摘要课其→实学周次讲程他(必含章节名称、讲述的内容提要、实验的名称、教学方法、课堂讨论的题目、题时授讨阅读文献参考书目及作业等)环课论节教学方法:讲授和案例教学,第一章获取数据1.1直接下载开源数据集;购买:第一周331.2 API聚合API;聚宽API:1.3 爬取爬取工具:八爪鱼一模板:八爪鱼一自定义:教学方法:讲授和案例教学。1.4WebScraper插件1.4.1安装OpenWebScraper第二周31.4.2 Scrapinga site3Create SitemapCreate selectors案例:oalib数据爬取。教学方法:讲授和案例教学1.4WebScraper插件1.4.3 Text selector第三周331.4.4Element selector1.4.5Scrapeand Export案例:oalib数据爬取
学习目标 ( Learning Outcomes) 1. 了解 Scrapy 框架结构及工作原理; 2. 掌握 Web Scraper 插件; 3. 熟悉 Spider 开发流程; 4. 使用 Selector 提取数据; 5. 使用 Item 封装数据; 6. 使用 Item Pipeline 处理数据; 7. 使用 LinkExtractor 提取链接; 8. 使用 Exporter 导出数据; 9. 掌握下载文件和图片; 10. 掌握爬取动态页面。 *考核方式 (Grading) 平时成绩 30%,期末成绩 70% *课程教学计划(Teaching Plan) 周次 周 学 时 其中 教学内容摘要 (必含章节名称、讲述的内容提要、实验的名称、教学方法、课堂讨论的题目、 阅读文献参考书目及作业等) 讲 授 实 验 课 习 题 课 课 程 讨 论 其 他 环 节 第一周 3 3 教学方法:讲授和案例教学。 第一章 获取数据 1.1 直接下载 开源数据集;购买; 1.2 API 聚合 API;聚宽 API; 1.3 爬取 爬取工具;八爪鱼—模板;八爪鱼—自定义; 第二周 3 3 教学方法:讲授和案例教学。 1.4 Web Scraper 插件 1.4.1 安装 Open Web Scraper 1.4.2 Scraping a site Create Sitemap Create selectors 案例:oalib 数据爬取。 第三周 3 3 教学方法:讲授和案例教学。 1.4 Web Scraper 插件 1.4.3 Text selector 1.4.4 Element selector 1.4.5 Scrape and Export 案例:oalib 数据爬取

教学方法:讲授和案例教学。1.4WebScraper插件1.4.5Paginationselector第四周3131.4.6 Link selector案例:oalib数据爬取教学方法:讲授和案例教学。第二章Scrapy入门2.1Scrapy简介官网:功能;2.2爬虫框架爬虫框架的作用:代码演示:第五周2.3Scrapy架构33架构简介;案例:Scrapy Tutorial安装Scrapy;创建爬虫工程:创建爬虫:提取数据;Scrapyshell:存储数据:处理链接教学方法:讲授和案例教学。第三章初识Scrapy3.1爬虫工作流程第六周33下载页面:提取页面中的数据:提取页面中的链接3.2Scrapy基本步骤项目需求:创建项目:分析页面:实现Spider:运行爬虫:教学方法:讲授和案例教学。第四章编写Spider4.1Scrapy框架结构及工作原理Scrapy框架工作流程;Scrapy组件:Request和Response对象;4.2Request和Response第七周3Request对象;Response对象;34.3Spider开发流程从哪里开始:提取哪些数据:处理哪些链接:案例:实现Spider的4个步骤;教学方法:讲授和案例教学。第五章使用Selector提取数据5.1Selector对象创建对象:选中数据:提取数据:第八周33.5.2XPathXML;基础语法:常用函数;5.3CSS选择器基本语法:
第四周 3 3 教学方法:讲授和案例教学。 1.4 Web Scraper 插件 1.4.5 Pagination selector 1.4.6 Link selector 案例:oalib 数据爬取。 第五周 3 3 教学方法:讲授和案例教学。 第二章 Scrapy 入门 2.1 Scrapy 简介 官网;功能; 2.2 爬虫框架 爬虫框架的作用;代码演示; 2.3 Scrapy 架构 架构简介; 案例: Scrapy Tutorial 安装 Scrapy;创建爬虫工程;创建爬虫;提取数据; Scrapy shell;存储数据;处理链接; 第六周 3 3 教学方法:讲授和案例教学。 第三章 初识 Scrapy 3.1 爬虫工作流程 下载页面;提取页面中的数据;提取页面中的链接; 3.2 Scrapy 基本步骤 项目需求;创建项目;分析页面;实现 Spider;运行爬虫; 第七周 3 3 教学方法:讲授和案例教学。 第四章 编写 Spider 4.1 Scrapy 框架结构及工作原理 Scrapy 框架工作流程;Scrapy 组件;Request 和 Response 对象; 4.2 Request 和 Response Request 对象;Response 对象; 4.3 Spider 开发流程 从哪里开始;提取哪些数据;处理哪些链接; 案例: 实现 Spider 的 4 个步骤; 第八周 3 3 教学方法:讲授和案例教学。 第五章 使用 Selector 提取数据 5.1 Selector 对象 创建对象;选中数据;提取数据; 5.2 XPath XML;基础语法;常用函数; 5.3 CSS 选择器 基本语法;

教学方法:讲授和案例教学。第六章使用Item封装数据6.1Item和FieldItem基类和Field类;第九周336.2Item和Filed用法创建Item:设置Field:6.3在Scrapy中使用Item和Field修改items.py;修改BooksSpider;教学方法:讲授和案例教学。第七章使用ItemPipeline处理数据7.1ItemPipeline第十周33修改pipelines.py;修改settings.py;7.2更多案例过滤重复数据:将数据存入MongoDB:教学方法:讲授和案例教学。第八章使用LinkExtractor提取链接8.1使用LinkExtractor第十一周3创建LinkExtractor;调用LinkExtractor对象的extract_links方法:38.2描述提取规则allow参数;deny参数:allow_domains参数;deny_domains参数;tags参数;attrs参数;教学方法:讲授和案例教学。第九章使用Exporter导出数据9.1指定如何导出数据第十二周33命令行参数:配置文件:9.2添加导出数据格式创建my_exporters.py;设置settings.py文件;教学方法:讲授和案例教学。第十章项目练习10.1项目需求确认抓取数据:第十三周10.2页面分析E33Scrapyshell:Chrome开发工具:10.3编码实现创建工程;创建爬虫;修改items.py文件:设置BooksSpider设置Pipeline;教学方法:讲授和案例教学。第十一章下载文件和图片11.1FilesPipeline和ImagesPipelineFilesPipeline参数:ImagesPipeline参数:第十四周&311.2爬取matplotlib例子源码文件项目需求;页面分析:编码实现;11.2下载360图片项目需求;页面分析:编码实现;
第九周 3 3 教学方法:讲授和案例教学。 第六章 使用 Item 封装数据 6.1 Item 和 Field Item 基类和 Field 类; 6.2 Item 和 Filed 用法 创建 Item;设置 Field; 6.3 在 Scrapy 中使用 Item 和 Field 修改 items.py;修改 BooksSpider; 第十周 3 3 教学方法:讲授和案例教学。 第七章 使用 Item Pipeline 处理数据 7.1 Item Pipeline 修改 pipelines.py;修改 settings.py; 7.2 更多案例 过滤重复数据;将数据存入 MongoDB; 第十一周 3 3 教学方法:讲授和案例教学。 第八章 使用 LinkExtractor 提取链接 8.1 使用 LinkExtractor 创建 LinkExtractor;调用 LinkExtractor 对象的 extract_links 方法; 8.2 描述提取规则 allow 参数;deny 参数;allow_domains 参数;deny_domains 参数; tags 参数;attrs 参数; 第十二周 3 3 教学方法:讲授和案例教学。 第九章 使用 Exporter 导出数据 9.1 指定如何导出数据 命令行参数;配置文件; 9.2 添加导出数据格式 创建 my_exporters.py;设置 settings.py 文件; 第十三周 3 3 教学方法:讲授和案例教学。 第十章 项目练习 10.1 项目需求 确认抓取数据; 10.2 页面分析 Scrapy shell;Chrome 开发工具; 10.3 编码实现 创建工程;创建爬虫;修改 items.py 文件;设置 BooksSpider; 设置 Pipeline; 第十四周 3 3 教学方法:讲授和案例教学。 第十一章 下载文件和图片 11. 1 FilesPipeline 和 ImagesPipeline FilesPipeline 参数;ImagesPipeline 参数; 11.2 爬取 matplotlib 例子源码文件 项目需求;页面分析;编码实现; 11.2 下载 360 图片 项目需求;页面分析;编码实现;

教学方法:讲授和案例教学。第十二章爬取动态页面12.1动态页面分析页面;查看JavaScript;第十五周3312.2Splash渣染引擎主要功能:docker:开启Splash服务:render.html端点:12.2在 Scrapy中使用 Splash安装scrapy-splash;编码实现;第十六周复习33总计4848备注(Notes)
第十五周 3 3 教学方法:讲授和案例教学。 第十二章 爬取动态页面 12.1 动态页面 分析页面;查看 JavaScript; 12.2 Splash 渲染引擎 主要功能;docker;开启 Splash 服务;render.html 端点; 12.2 在 Scrapy 中使用 Splash 安装 scrapy-splash;编码实现; 第十六周 3 3 复习 总计 48 48 备注(Notes)