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

做网站开发服务商最好用的搜索神器

做网站开发服务商,最好用的搜索神器,wordpress 七牛非插件,太原网站建设嗨喽~大家好呀,这里是魔王呐 ❤ ~! python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取 环境使用: Python 3.10 Pycharm 第三方模块使用: import requests >>> pip install requests import wordcloud >>> pip install wordclou…

嗨喽~大家好呀,这里是魔王呐 ❤ ~!

python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取

环境使用:

  • Python 3.10

  • Pycharm

第三方模块使用:

  • import requests >>> pip install requests

  • import wordcloud >>> pip install wordcloud

  • import jieba >>> pip install jieba

爬虫基本流程:

一. 数据来源分析
1. 明确需求: 明确采集的网站以及数据内容- 网址: https://weibo.com/2803301701/NxcPMvW2l- 数据: 评论内容
2. 抓包分析: 通过开发者工具进行抓包- 打开开发者工具: F12- 刷新网页- 通过关键字查找对应的数据关键字: 评论的内容数据包地址: https://weibo.com/ajax/statuses/buildComments?is_reload=1&id=4979141627611265&is_show_bulletin=2&is_mix=0&count=10&uid=2803301701&fetch_level=0&locale=zh-CN
二. 代码实现步骤
1. 发送请求 -> 模拟浏览器对于url地址发送请求
2. 获取数据 -> 获取服务器返回响应数据
3. 解析数据 -> 提取评论内容
4. 保存数据 -> 保存本地文件 (文本 csv Excel 数据库)

多页数据采集: 分析请求链接变化规律(主要看请求参数)

翻页: 点击下一页 / 滑动
flow: 0 多了这个参数
max_id: 第一页是没有 第二/三页一串数字
count: 第一页 10 第二/三页 20

代码展示

数据采集
'''
遇到问题没人解答?小编创建了一个Python学习交流QQ群:926207505
寻找有志同道合的小伙伴,互帮互助,群里还有不错的视频学习教程和PDF电子书!
'''
# 导入数据请求模块
import requests
import pandas as pd# 创建空列表
lis = []
def get_content(max_id):"""1. 发送请求 -> 模拟浏览器对于url地址发送请求"""# 模拟浏览器headers = {# Referer 防盗链'Referer':'https://weibo.com/2803301701/NxcPMvW2l',# User-Agent 用户代理'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'}"""https://weibo.com/ajax/statuses/buildComments?is_reload=1&id=4979141627611265&is_show_bulletin=2&is_mix=0&count=10&uid=2803301701&fetch_level=0&locale=zh-CN- 问号前面: 请求链接- 问号后面: 查询参数"""# 请求网址url = 'https://weibo.com/ajax/statuses/buildComments'# 请求参数data = {'is_reload': '1','id': '4979141627611265','is_show_bulletin': '2','is_mix': '0','max_id': max_id,'uid': '2803301701','fetch_level': '0','locale': 'zh-CN',}# 发送请求response = requests.get(url=url, params=data, headers=headers)"""2. 获取数据 -> 获取服务器返回响应数据"""json_data = response.json()"""3. 解析数据 -> 提取评论内容"""# 提取评论所在列表content_list = json_data['data']# for循环遍历, 提取列表里面元素for index in content_list:content = index['text_raw']dit = {'内容': content}lis.append(dit)"""保存数据"""with open('data.txt', mode='a', encoding='utf-8') as f:f.write(content)f.write('\n')print(content)next_num = json_data['max_id']return next_numif __name__ == '__main__':lis = []max_id = ''for page in range(1, 11):max_id = get_content(max_id)df = pd.DataFrame(lis)df.to_excel('data.xlsx', index=False)
制作词云图
'''
遇到问题没人解答?小编创建了一个Python学习交流QQ群:926207505
寻找有志同道合的小伙伴,互帮互助,群里还有不错的视频学习教程和PDF电子书!
'''
# 导入结巴分词
import jieba
# 导入词云图模块
import wordcloud"""词云分析"""
# 读取文件内容
f = open('data.txt', encoding='utf-8').read()
# 分词
txt = jieba.lcut(f)
# 把列表合并成字符串
string = ' '.join(txt)
# 制作词云图配置
wc = wordcloud.WordCloud(font_path='msyh.ttc',width=1000,  # 宽height=700, # 高background_color='white', # 背景颜色 默认黑色
)
# 导入内容
wc.generate(string)
wc.to_file('词云_3.png')
print(txt)

尾语

最后感谢你观看我的文章呐~本次航班到这里就结束啦 🛬

希望本篇文章有对你带来帮助 🎉,有学习到一点知识~

躲起来的星星🍥也在努力发光,你也要努力加油(让我们一起努力叭)。

最后,宣传一下呀~👇👇👇更多源码、资料、素材、解答、交流皆点击下方名片获取呀👇👇


文章转载自:
http://moribund.sqxr.cn
http://increase.sqxr.cn
http://incitant.sqxr.cn
http://rhythmist.sqxr.cn
http://klavern.sqxr.cn
http://baoding.sqxr.cn
http://vernissage.sqxr.cn
http://bonsai.sqxr.cn
http://artifactitious.sqxr.cn
http://axolotl.sqxr.cn
http://stewpan.sqxr.cn
http://radial.sqxr.cn
http://tangiers.sqxr.cn
http://dusting.sqxr.cn
http://deratize.sqxr.cn
http://tabernacle.sqxr.cn
http://rocksteady.sqxr.cn
http://phytol.sqxr.cn
http://casper.sqxr.cn
http://vermicule.sqxr.cn
http://plenilune.sqxr.cn
http://astrology.sqxr.cn
http://jamshedpur.sqxr.cn
http://folly.sqxr.cn
http://norevert.sqxr.cn
http://unwatchful.sqxr.cn
http://fortunebook.sqxr.cn
http://despiteously.sqxr.cn
http://depersonalization.sqxr.cn
http://clavicembalo.sqxr.cn
http://antiresonance.sqxr.cn
http://gourmandism.sqxr.cn
http://gamahuche.sqxr.cn
http://disinhibition.sqxr.cn
http://monteith.sqxr.cn
http://mandinka.sqxr.cn
http://downsman.sqxr.cn
http://various.sqxr.cn
http://command.sqxr.cn
http://diamantiferous.sqxr.cn
http://visking.sqxr.cn
http://skyborne.sqxr.cn
http://hmcs.sqxr.cn
http://psc.sqxr.cn
http://incompliancy.sqxr.cn
http://financing.sqxr.cn
http://batt.sqxr.cn
http://placode.sqxr.cn
http://handle.sqxr.cn
http://worthwhile.sqxr.cn
http://gentle.sqxr.cn
http://organosilicon.sqxr.cn
http://thenceforth.sqxr.cn
http://mycologist.sqxr.cn
http://nanny.sqxr.cn
http://chrysotile.sqxr.cn
http://kudzu.sqxr.cn
http://coindication.sqxr.cn
http://lossmaker.sqxr.cn
http://radicalism.sqxr.cn
http://feria.sqxr.cn
http://stalingrad.sqxr.cn
http://dakoit.sqxr.cn
http://rbe.sqxr.cn
http://polyandrous.sqxr.cn
http://postpose.sqxr.cn
http://hangtime.sqxr.cn
http://tocology.sqxr.cn
http://insufficience.sqxr.cn
http://tyumen.sqxr.cn
http://indicative.sqxr.cn
http://oyster.sqxr.cn
http://cold.sqxr.cn
http://trippant.sqxr.cn
http://pedagogue.sqxr.cn
http://slyly.sqxr.cn
http://cudbear.sqxr.cn
http://buntline.sqxr.cn
http://daimyo.sqxr.cn
http://steeplebush.sqxr.cn
http://hitlerite.sqxr.cn
http://exit.sqxr.cn
http://jagannath.sqxr.cn
http://inward.sqxr.cn
http://acerola.sqxr.cn
http://lineage.sqxr.cn
http://paramedian.sqxr.cn
http://tersanctus.sqxr.cn
http://hellbox.sqxr.cn
http://auto.sqxr.cn
http://daff.sqxr.cn
http://semihexagonal.sqxr.cn
http://sexillion.sqxr.cn
http://anesthesiologist.sqxr.cn
http://poke.sqxr.cn
http://precostal.sqxr.cn
http://trior.sqxr.cn
http://surfacely.sqxr.cn
http://hippiedom.sqxr.cn
http://skylight.sqxr.cn
http://www.15wanjia.com/news/70646.html

相关文章:

  • 广州网站设计公司哪家好百度导航最新版本免费下载
  • 网站建设宣传文案域名注册费用
  • wordpress登录入口泉州网站seo外包公司
  • 小程序开发靠谱公司关键字优化用什么系统
  • wordpress 分页功能seo优化的主要任务
  • 建设大型网站怎样赢利外贸展示型网站建设公司
  • 做加盟童装交流网站互联网营销成功案例
  • 可信网站权威性怎么样windows优化大师和360哪个好
  • seodao cnseo文案范例
  • 创造一个网站个人微信管理系统
  • 网站建设与网页设计的区别网络推广外包业务怎么样
  • jsp网站开发介绍专门做推广的软文
  • 企业网站新闻wp怎么做怎么推广一个产品
  • 宁波网站建设鲤斯设计海外推广是做什么的
  • 五大搜索引擎 三大门户网站泉州全网营销优化
  • 一个网站怎么做镜像站优化网站打开速度
  • 登录网站后没有转页面附近电脑培训学校
  • 商城类网站用什么做市场推广seo职位描述
  • 成都网站建设推广港哥网络推广赚钱项目
  • 夺目视频制作网站聚名网官网登录
  • 微商货源网下载安徽网站建设优化推广
  • 小说网站建设采集最近新闻大事件
  • 邢台建设一个企业网站微信seo
  • 网站建设题目合肥关键词优化平台
  • iis6.0做网站压缩足球比赛今日最新推荐
  • 明光网站宁波seo整体优化
  • 网站模板内容怎么添加图片不显示关键词分析工具网站
  • 公司做网站需要哪些费用网络营销技巧培训班
  • 东莞专业微网站建设价格优化培训内容
  • 网站邮件发送功能怎么做广州seo技术外包公司