龙源期刊网
http://www.qikan.com.cn
基于
Python
的新浪新闻爬虫系统的设计与
实现
作者:陈猛
来源:《现代信息科技》
2018
年第
07
期
摘
要:网络爬虫属于网络机器人,也被称为网页蜘蛛。随着科学技术在人们生活中的不
断渗透,对计算机的依赖程度逐渐提升,搜索引擎也变得更加重要,但是以往传统的搜索引擎
已经难以满足现代化需求。对此,本文在
Python
的基础上研究出了一种新型的网络爬虫,它
能够很好地克服传统引擎中存在的弊端,为人们提供更多、更全面的搜索内容。基于此,本文
将以新浪新闻为例,对
Python
爬虫系统的设计与实现进行分析。
关键词:
Python
;新浪新闻;爬虫系统
中图分类号:
TP391.1
;
TP393.092
文献标识码:
A
文章编号:
2096-4706
(
2018
)
07-0111-
02
Abstract
:
The network crawler belongs to the network robot
,
also known as the web spider.
With the continuous infiltration of science and technology in human life
,
the dependence degree of
the computer is increasing gradually
,
and the search engine is becoming more important. But the
traditional search engine has been difficult to meet the needs of modernization. Based on Python
,
a
new type of web crawler is developed. It can overcome the drawbacks in the traditional engine and
provide more comprehensive search content for people. Based on this
,
this article will take Sina
News as an example to analyze the design and implementation of Python crawler system.
Keywords
:
Python
;
Sina News
;
crawler system
0
引
言
在以往使用传统搜索引擎的过程中,通常会存在一些不需要的信息,这些信息使人们对所
需信息的获取受到阻碍,展现出搜索引擎的弊端。在网络技术不断发展的背景下,传统搜索引
擎将会浪费很多时间,不利于搜索效率的提升。而
Python
基础上的爬虫系统的设计与实现,
将使信息的搜索效率得到显著提升,目前在新浪新闻中得到广泛应用。
1 Python
爬虫系统设计
网络爬虫主要是借助每个网页的网址对相关内容进行筛选后,将最终结果呈现在用户面
前,而不是单纯地通过人工浏览的方式获取所需信息。
Python
属于脚本语言的一种,具有
urllib
、
urllib2
相关爬虫基础库。在
Python
语言基础上开发一款软件,名为
Scrapy
,它能够适
用于
Windows
、
Linux
等多种系统。如若获取到的网页中存在大量的
HTML
代码,则在以往的