登录

  • 登录
  • 忘记密码?点击找回

注册

  • 获取手机验证码 60
  • 注册

找回密码

  • 获取手机验证码60
  • 找回
毕业论文网 > 毕业论文 > 计算机类 > 软件工程 > 正文

基于学生舆情分析的Python爬虫系统的设计与应用毕业论文

 2020-08-20 08:08  

摘 要

随着互联网的进一步普及以及推广,特别是“微博”“微信”“百度贴吧”等众多网络社交软件以及网络论坛的崛起,网络上热议的话题得到传统媒体的积极响应和深入挖掘。这些软件以及论坛都是具有交互性且传播速度极快的工具,他们的传播速度远远超过了传统的媒体,由此可见网络交互正在改变着舆论的格局,它对于社会的影响力也是与日俱增。

但是由于网络言论的开放化以及网民素质的良莠不齐,网络也成了谣言泛滥,甚至是导致社会不和谐的重灾区,因此,有必要建立一个相关的网络舆论监控系统来监控网络上的舆论情况,以达到维持“网络社会”的安定。学生作为未来社会的主要推动力以及现在网络时代中最活跃也是人数最多的群体,对于学生的网络舆论情况的监控更是必不可少。

Python语言作为一种高级计算机语言,代码编码简单明了,很适合根据实际情况快速修改代码,非常适应现在网络上内容、布局多变的情况,利用Python语言进行相关网络舆论监控系统的快速开发,相对其他语言来说更具优势。

由于学生群体大多活跃在“微博”“百度贴吧”等大型网络社交论坛,针对这一特点,本文主要研究了通过Python语言,设计一种基于Python爬虫程序的设计方法,利用Python语言中的urllib模块对“百度贴吧-武汉理工大学贴”的网页进行抓取。该工具利用Python中正则表达式的关键词匹配技术,匹配符合规定条件的“贴吧”内容,并抓取这些内容,根据对抓取内容回复内容人数的降序排列得排列后的内容,通过这些内容来对学生舆论情况进行监控和分析。

实验结果表明:本程序具有针对性强,对数据的收集爬取速度快,易嵌入开发,代码简单明了易于维护等优点,为不善于编程的研究者们提供了快速获取“百度贴吧-武汉理工大学贴”上学生的舆论情况,有利于对学生舆论情况进行监控以及后续的数据挖掘和研究。

关键词:Python;爬虫;百度贴吧;学生舆情

Abstract

With the further popularization and promotion of the Internet, especially the "microblogging" "WeChat" "Baidu Post Bar" and many other social networking software and the rise of the network forum, the hot topic on the network by the traditional media positive response and in-depth mining. These software and forums are interactive and very fast transmission of the tools, their spread far more than the traditional media, we can see that the network interaction is changing the pattern of public opinion, it is the influence of the community is growing.

However, due to the openness of network speech and the quality of Internet users, the network has become a rumor spread, and even lead to social dissonance of the hardest hit, therefore, it is necessary to establish a related network of public opinion monitoring system to monitor the network of public opinion, In order to achieve the maintenance of "network society" stability. Students as the main driving force of the future society and now the most active network era is the largest number of groups, for the students to monitor the network of public opinion is essential.

Python language as a high-level computer language, code code is simple and clear, it is suitable for the actual situation to quickly modify the code, very adapt to the current content on the network, the layout of the situation, the use of Python language related to the rapid development of public opinion monitoring system, relative Other languages are more advantages.

As the student community mostly active in the "microblogging" "Baidu Post Bar" and other large-scale social networking forum, in view of this feature, this paper mainly through the Python language, based on the design of a Python crawler program design method, the use of Python language urllib Module on the "Baidu Post Bar - Wuhan University of Technology posted" page to crawl. The tool uses Python's regular expression keyword matching technique to match the "sticky" content that meets the specified criteria and fetch the content, sorting the content based on the descending order of the number of people who crawl the content To monitor and analyze the students' public opinion.

The experimental results show that the program has the advantages of strong pertinence, fast acquisition of data, easy embedding development, easy and easy maintenance of the code, and provides quick access to the researchers who are not good at programming. University paste "on the students of public opinion, is conducive to the monitoring of student opinion and follow-up data mining and research.

Key Words:Python; crawler; Baidu Post it; student public opinion

目录

第1章 绪论 1

1.1 选题价值 1

1.2 学生舆情监控的意义 1

第2章 Python 1

2.1 Python语言的现状 2

2.2 Python语言的特点 2

2.2.1 简洁,易懂 2

2.2.2 开源,免费 2

2.2.3 可移植性 3

2.2.4 面向对象 3

2.2.5 解释性 3

2.2.6 可扩展性 4

2.2.7 可嵌入性 4

2.2.8 丰富的库 4

第3章 简单爬虫系统的设计与实现 4

3.1 开发环境搭建 4

3.1.1 系统开发环境 4

3.1.2 Python开发环境搭建 4

3.1.3 安装scrapy框架 5

3.1.4 安装requests第三方模块 5

3.1.5 安装BeautifulSoup第三方模块 5

3.1.6 安装lxml第三方解析器 5

3.1.7 在Eclipse上搭建pydev环境 6

3.2 爬虫设计思路 6

3.2.1 简单爬虫架构设计 6

3.2.1 简单爬虫运行流程 7

3.3 爬虫系统的具体实现 7

3.3.1 爬虫调度器模块 8

3.3.2 URL管理器模块 9

3.3.3 网页下载器模块 10

3.3.4 网页解析器模块 11

3.3.5 数据输出器模块 11

第4章 爬取数据并存入数据库 12

4.1 数据库环境搭建 12

4.1.1 系统环境 12

4.1.2 MySql安装和配置 12

4.1.3 安装MySql-python包 13

4.2 将爬取到的数据存入数据库 13

4.2.1 引入数据库模块 13

4.2.2 将爬取到的数据存入数据库 13

4.2.3 数据库中的数据进行降序排列 14

第5章 舆情分析系统运行 14

5.1 系统运行 14

5.2 系统运行结果分析及改进 14

第6章 结语 15

  1. 绪论

随着互联网上交互社交活动的迅速普及以及推广,特别是“微博”“微信”“百度贴吧”等众多网络社交软件以及网络论坛的崛起,网络上热议的话题得到传统媒体的积极响应和深入挖掘。这些软件以及论坛都是具有交互性且传播速度极快的工具,他们的传播速度远远超过了传统的媒体,由此可见网络交互正在改变着舆论的格局,它对于社会的影响力也是与日俱增。

1.1 选题价值

在逐渐进入大数据时代的今天,在互联网上面对海量的数据,我们已经无法想象再通过人工的手发来挑选出其中对我们有用的数据。那么问题就来了,对于现在这个各种网络社交软件以及网络论坛不断崛起的网络社会,结合网络信息采集和信息文本处理等技术来开发一个对用户有用的舆情监控系统是十分必要的,这样一个系统将会帮助我们在海量的互联网数据中挑选出我们想要的数据并且准确的过滤掉那些对我们无用的垃圾信息,大大减少我们收集数据和处理数据的时间,把我们的时间损耗降到最低。

1.2 学生舆情监控的意义

由于网络言论的开放化以及网民素质的良莠不齐,网络也成了谣言泛滥,甚至是导致社会不和谐的重灾区,学生作为推动这个社会的新生力量无疑是现在活跃在网络上人数最多的群体,近年来,因为某些突发性事件或重大新闻引发的关注与讨论,一些社会人士在某些网络论坛上通过夸大事实、扭曲事实、发表不良言论等带动一些学生群体和国内甚至国外的网民进行争论甚至是进行言语上的攻击。学生大多都是一些尚未真正踏入社会的,几乎没有社会经验的未成年人或刚刚成年的年轻人,这个年龄段的人尚还处学习的阶段,他们的世界观、人生观、价值观都还并没有完全成型,还处于最为重要的塑形期,对于错误思想辨别能力和抵抗能力都还很弱,而且遇事很容易冲动,对社会上的问题缺乏客观、理性的分析,极易受到煽动而产生非理性的行为。因此对于学生的网络舆论情况的监控是必不可少的。

  1. Python

Python,是一种面向对象的解释型计算机程序语言,它的“父亲”是荷兰人Guido van Rossum。Python在1989年“出生”之后,就受到了广大编程人员的欢迎,并在之后不断的发生着变化。

2.1 Python语言的现状

早在90年代当最早的搜索引擎出现时,为了配合搜索引擎对互联网上大范围的数据进行搜索,也就衍生出了最早的网络爬虫。这个时候的网络爬虫在爬取的时候都是使用深度或广度优先的遍历方式。在搜索引擎中最为重要的一部就是要在庞大的互联网中爬取,采集用户所需要的信息,而作为完成这一系列工作核心的网络爬虫,其的性能的好坏,爬取效率的高低,爬取范围的大小等都将直接影响到整个搜索引擎对网页搜索的质量,数量,而网络爬虫的功能强弱也成为一个搜索引擎性能好坏的重要判断因素,也因此出现了后来的分布式网络爬虫。后来出现的分布式爬虫相对于之前的网络爬虫已经有了很大不同,不仅大大提高了爬取时的效率,而且其书写编译也更为简单。就目前而言,分布式网络爬虫已经有了不少比较成熟的应用,其中就有著名的Google和Alta Vista搜索引擎。

正因为网络爬虫的重要性,Twisted使用Python语言通过非堵塞的异步处理方式编写了一个非常受欢迎的爬虫事件驱动网络框架:scrapy。Scrapy作为一个能够轰动整个爬虫编译界的框架,它能够对Web页面进行爬取,除此之外从页面中提取结构化的数据也是它的特点之一。它的功能也非常强大,可以用来进行数据的挖掘、监测、自动化测试等工作。

2.2 Python语言的特点

您需要先支付 80元 才能查看全部内容!立即支付

企业微信

Copyright © 2010-2022 毕业论文网 站点地图