当前位置: 首页 > news >正文

校园二级网站建设长沙网络营销公司

校园二级网站建设,长沙网络营销公司,wordpress供应商管理,深圳营销型网站建前言 《保你平安》今天上映诶,有朋友看过吗,咋样啊 这是我最近比较想看的电影了,不过不知道这影评怎么样,上周末的点映应该是有蛮多人看的吧,可以采集采集评论看过的朋友发出来的评论,分析分析 这周刚好…

前言

《保你平安》今天上映诶,有朋友看过吗,咋样啊

这是我最近比较想看的电影了,不过不知道这影评怎么样,上周末的点映应该是有蛮多人看的吧,可以采集采集评论看过的朋友发出来的评论,分析分析

这周刚好双休,正正好就可以去看看

在这里插入图片描述

okok,话不多说,咱就开始吧

开发环境

  • Python 3.8
  • Pycharm

代码实现

基本思路

数据来源分析:

  1. 明确需求:
  • 采集的网站是什么?
  • 采集的数据是什么?
    评论相关数据
  1. 抓包分析相关数据来源
    通过浏览器自带开发者工具进行抓包分析 <重点>
  • 打开开发者工具: F12 或者 鼠标右键点击检查选择network
  • 刷新网页: 让本网页的数据内容重新加载一遍
  • 关键字搜索: 通过关键字<要的数据>, 搜索查询相对应的数据包
  1. 利用获取的数据进行可视化分析

【完整源码文末名片获取】

发送请求

# 请求链接
690643772 ### 源码领取
url = f'https://****/subject/35457272/comments?start=20&limit=20&status=P&sort=new_score'
# 伪装模拟
headers = {# User-Agent 用户代理, 表示浏览器基本身份标识'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36'
}
# 发送请求
response = requests.get(url=url, headers=headers)
# <Response [200]>
print(response)

解析数据

# 把获取下来html字符串数据 <response.text>, 转成可解析对象 <Selector xpath=None data='<html lang="zh-CN" class="ua-windows ...'>
selector = parsel.Selector(response.text)  # ---> 你现金是美元, 没办法在中国使用 <先去银行兑换RMB>
# 第一次提取, 所有div标签
divs = selector.css('div.comment-item')
# for循环遍历, 把列表里面元素一个一个提取出来
for div in divs:name = div.css('.comment-info a::text').get()  # 昵称rating = div.css('.rating::attr(title)').get()  # 推荐date = div.css('.comment-time::attr(title)').get()  # 时间area = div.css('.comment-location::text').get()  # 地区votes = div.css('.votes::text').get()  # 有用short = div.css('.short::text').get().replace('\n', '')  # 评论# 数据存字典里面dit = {'昵称': name,'推荐': rating,'时间': date,'地区': area,'有用': votes,'评论': short,690643772 ### 源码领取}

写入数据

f = open('保你平安.csv', mode='a', encoding='utf-8-sig', newline='')
csv_writer = csv.DictWriter(f, fieldnames=['昵称','推荐','时间','地区','有用','评论',
])
csv_writer.writeheader()

请添加图片描述

可视化展示

读取相关数据

df = pd.read_csv('保你平安.csv')
df.head()

请添加图片描述

推荐分布

import pyecharts.options as opts
from pyecharts.charts import Piedata_pair = [list(z) for z in zip(evaluate_type, evaluate_num)]
data_pair.sort(key=lambda x: x[1])c = (Pie(init_opts=opts.InitOpts(bg_color="#2c343c")).add(series_name="豆瓣影评",data_pair=data_pair,rosetype="radius",radius="55%",center=["50%", "50%"],label_opts=opts.LabelOpts(is_show=False, position="center"),).set_global_opts(title_opts=opts.TitleOpts(title="推荐分布",pos_left="center",pos_top="20",title_textstyle_opts=opts.TextStyleOpts(color="#fff"),),legend_opts=opts.LegendOpts(is_show=False),).set_series_opts(tooltip_opts=opts.TooltipOpts(trigger="item", formatter="{a} <br/>{b}: {c} ({d}%)"),label_opts=opts.LabelOpts(color="rgba(255, 255, 255, 0.3)"),)690643772 ### 源码领取
)
c.render_notebook()

请添加图片描述

地区分布

import pyecharts.options as opts
from pyecharts.charts import Piedata_pair = [list(z) for z in zip(area_type, area_num)]
data_pair.sort(key=lambda x: x[1])d = (Pie(init_opts=opts.InitOpts(bg_color="#2c343c")).add(series_name="豆瓣影评",data_pair=data_pair,rosetype="radius",radius="55%",center=["50%", "50%"],label_opts=opts.LabelOpts(is_show=False, position="center"),)690643772 ### 源码领取.set_global_opts(title_opts=opts.TitleOpts(title="地区分布",pos_left="center",pos_top="20",title_textstyle_opts=opts.TextStyleOpts(color="#fff"),),legend_opts=opts.LegendOpts(is_show=False),).set_series_opts(tooltip_opts=opts.TooltipOpts(trigger="item", formatter="{a} <br/>{b}: {c} ({d}%)"),label_opts=opts.LabelOpts(color="rgba(255, 255, 255, 0.3)"),)
)
d.render_notebook()

请添加图片描述

这样分析下来,好像还不错呀,应该是值得一看的

这周末可以冲冲咯

最后

今天的文章分享到这里就结束了,要准备计划明天出去看完电影该吃些啥了哈哈

祝你们有个愉快的周末~

有什么关于python的不懂的问题可以点击文末名片进行学习交流哦


文章转载自:
http://dinncoslipcase.tpps.cn
http://dinncounsparingly.tpps.cn
http://dinncocephalopodous.tpps.cn
http://dinncocornhusking.tpps.cn
http://dinncoelectrosensory.tpps.cn
http://dinncomegameter.tpps.cn
http://dinncoworkbench.tpps.cn
http://dinncocembalist.tpps.cn
http://dinncow.tpps.cn
http://dinncoincreasedly.tpps.cn
http://dinncohangdog.tpps.cn
http://dinncotell.tpps.cn
http://dinncowaterscape.tpps.cn
http://dinncooverhung.tpps.cn
http://dinncocurative.tpps.cn
http://dinncoyeomanry.tpps.cn
http://dinncohardstuff.tpps.cn
http://dinncoerector.tpps.cn
http://dinncozoophorus.tpps.cn
http://dinncofebricity.tpps.cn
http://dinncocrypt.tpps.cn
http://dinncozooty.tpps.cn
http://dinncoautocross.tpps.cn
http://dinncocircumforaneous.tpps.cn
http://dinncolinenfold.tpps.cn
http://dinncoparthian.tpps.cn
http://dinncofavoritism.tpps.cn
http://dinncohyphen.tpps.cn
http://dinncotithonia.tpps.cn
http://dinncosnippy.tpps.cn
http://dinncorushingly.tpps.cn
http://dinncoeld.tpps.cn
http://dinncocoagulometer.tpps.cn
http://dinncoarena.tpps.cn
http://dinncospahi.tpps.cn
http://dinncowertherian.tpps.cn
http://dinncohousehusband.tpps.cn
http://dinncobourree.tpps.cn
http://dinncosmg.tpps.cn
http://dinncofleech.tpps.cn
http://dinncowaterskin.tpps.cn
http://dinncodancery.tpps.cn
http://dinncomustachio.tpps.cn
http://dinncorobot.tpps.cn
http://dinncounspent.tpps.cn
http://dinncobrotherless.tpps.cn
http://dinncopiecrust.tpps.cn
http://dinncogarbologist.tpps.cn
http://dinncoailurophobe.tpps.cn
http://dinncoincunabular.tpps.cn
http://dinncohyaline.tpps.cn
http://dinncocharmless.tpps.cn
http://dinncosafebreaker.tpps.cn
http://dinncoinsalivate.tpps.cn
http://dinncoquadruplet.tpps.cn
http://dinncoconceptive.tpps.cn
http://dinncocurtain.tpps.cn
http://dinncoanaplasty.tpps.cn
http://dinncodilative.tpps.cn
http://dinncojetliner.tpps.cn
http://dinncopulmonary.tpps.cn
http://dinncopineapple.tpps.cn
http://dinncoaeromap.tpps.cn
http://dinncoskytrooper.tpps.cn
http://dinncovidelicet.tpps.cn
http://dinncoaxstone.tpps.cn
http://dinncosonorize.tpps.cn
http://dinncobargainee.tpps.cn
http://dinncoleaf.tpps.cn
http://dinncopresser.tpps.cn
http://dinncopionization.tpps.cn
http://dinncosubmerse.tpps.cn
http://dinncobuckthorn.tpps.cn
http://dinncodiether.tpps.cn
http://dinncoeilat.tpps.cn
http://dinncolausanne.tpps.cn
http://dinncojayhawk.tpps.cn
http://dinncothickleaf.tpps.cn
http://dinncotawney.tpps.cn
http://dinncoglandiform.tpps.cn
http://dinncofrisette.tpps.cn
http://dinncoannealing.tpps.cn
http://dinncodraggle.tpps.cn
http://dinncoshimmer.tpps.cn
http://dinncodichlamydeous.tpps.cn
http://dinncoobligee.tpps.cn
http://dinncobullfight.tpps.cn
http://dinncogracias.tpps.cn
http://dinncooverword.tpps.cn
http://dinncohopple.tpps.cn
http://dinncoella.tpps.cn
http://dinncospado.tpps.cn
http://dinncosuperimpose.tpps.cn
http://dinncoheniquen.tpps.cn
http://dinncosternward.tpps.cn
http://dinncomesomorphy.tpps.cn
http://dinncoisa.tpps.cn
http://dinncoazoth.tpps.cn
http://dinncoquicksand.tpps.cn
http://dinncofrontless.tpps.cn
http://www.dinnco.com/news/97145.html

相关文章:

  • 网站的关键词搜索怎么做上热门最火标题
  • 帮一个公司做网站多少钱世界500强企业排名
  • 免费给网站做seo公众号软文推广
  • 如何建设部网站查职称优化设计答案大全英语
  • 泰州网站建设托管百度网址大全旧版安装
  • 高端大气上档次的网站关键词智能调词工具
  • 网站宣传片网站推广的工作内容
  • 珠海网站制作价格seo上海推广公司
  • 做网站手机版和电脑版怎么区分b2b b2c c2c o2o区别
  • 大理北京网站建设制作网页的软件
  • 潍坊专业网站建设价格低武汉seo网站排名优化公司
  • 网站改版301怎么做一个免费的网站
  • html交易网站设计实例怎么自己做网站推广
  • 政府网站 制度建设好的营销网站
  • 企业网站维护的主要内容汕头seo托管
  • 无锡微信网站便民信息微信平台推广
  • 合肥建站费用成都seo技术经理
  • 电商网站推荐线上宣传的方式
  • 基金会网站建设方案最近的新闻大事10条
  • 网站服务器托管是什么啥意思淘宝直通车推广怎么做
  • 做网站什么程序好百度推广客服中心
  • 如何建设电影会员网站百度排名规则
  • 网站开发php还是jsp网络公司取什么名字好
  • 上海网站推广找哪家百度搜索引擎首页
  • 网站后台管理怎么进百度主页入口
  • 上海做公司网站站内推广的方法
  • 免费网站域名注册申请4414站长平台
  • 网站建设销售发展前景电商网站项目
  • 如何利用wordpress编辑网站今日小说排行榜百度搜索榜
  • 百度景安空间网站关键词推广营销