基于云平台的网页抓取架构的研究与设计
2018-10-25范顺利周亦敏
范顺利 周亦敏
摘 要: 随着网络数据的迅速增长,网页数据抓取在处理大量数据时遇到了一些挑战,例如大量数据存储,需要密集计算能力以及数据提取的可靠性。提出了一个基于云平台的网页数据抓取架构,该架构使用AWS(Amazon Web Services)作为云平台,按需配置计算资源和数据存储;Selenium作为网页自动化工具,调用WebDriver API能够模拟用户使用浏览器。通过实验,比较了该架构与其他基于云的网页抓取架构的不同,并分析了它的优势。
关键词: AWS; 网页抓取; 大数据; Selenium
中图分类号:TP311.5 文献标志码:A 文章编号:1006-8228(2018)09-21-04
Abstract: With the rapid growth of data on the Internet, web scraping encounters a number of challenges in processing large amounts of data, such as large amounts of data storage, the need for intensive computing capabilities, and the reliability of data extraction. So, a web scraping architecture based on the cloud platform is proposed. The architecture uses AWS (Amazon Web Services) as the cloud platform and configures computing resources and data storage on demand. Selenium is a web page automation tool; the supported WebDriver API simulates the process of users using the browser. Through experiments, the differences between this architecture and other cloud-based web scraping architectures are compared, and its advantages are analyzed.
Key words: AWS; Web scraping; big data; Selenium
0 引言
互聯网提供了大量数据集, 但是很多数据都被嵌入到网页结构与样式中[1]。将可用的信息从网页中提取出来,挖掘其潜在价值,使其在金融、数据分析以及其他科学领域发挥重要作用。目前现有的多数解决方案主要侧重于网页数据的采集,数据采集是与数据科学相关的任何研究和开发的初步工作,而这只是大数据的第一步。因此,对于数据科学领域,提取网页数据并运用到数据科学领域十分重要。
网络上的大多数信息都是以HTML文档的形式呈现的,这些数据都是非结构化数据[2]。由于非结构化数据不遵循任何数据模型,因此信息提取并不容易。网页数据提取的过程包括:网页数据的解析、过滤、格式化结果和存储。在分布式计算领域,处理大量的网页抓取,可以使用BeautifulSoup,Requests和Scrapy[3]等各种库,但是,它们只能在静态页面上工作。因此,选择Selenium作为网页自动化工具,Python的HTMLParser库用于从HTML中提取数据[4]。……
