汇总:网站SEO诊断优化分析,SEO诊断注意事项(根据网站进行seo分析)
优采云 发布时间: 2022-10-13 05:21汇总:网站SEO诊断优化分析,SEO诊断注意事项(根据网站进行seo分析)
为什么要进行 SEO 诊断?只有通过系统的分析,才能发现网站的各种不足,而网站的任何问题都可以在诊断证书中体现出来。就搜索引擎蜘蛛而言,每解决一个网站问题都会增加1分,而这1分往往是排名的关键。如果你增加 10 点或 20 点呢?这种改善效果是显而易见的。
什么是网站SEO 分析?
网站位置。可能让你感到惊讶的是,影响网站排名的第一因素不是SEO技术问题,而是网站定位。所谓定位,就是为你的网站建立独特的差异化优势,而不是跟风。换句话说,给用户理由网站,而不是竞争网站。
关键词位置。特别是 关键词 应该出现在 title 标签中,并且每个页面必须有一个单独的 title 标签,以避免 关键词 与 title 标签堆叠。
网站内容质量。这主要包括两个方面,原创和内容的相关性。所以我们需要知道独立站建好后内容SEO怎么做。
内部链接。在影响网站排名的因素中,如果说外链很关键,那么内链是基础。
网站结构。网站有两种很好的物理结构:扁平化和树状,两者都可以链接形成逻辑树状结构,这正是搜索引擎所喜欢的。
如何从 SEO 角度诊断和分析 网站?
首先,检查域名信息。
通过工具查询。查看域名信息(域名年龄、),包括whois信息、pr、alexa排名等,url的使用是否合理等。
二、看网站结构框架、样式表、js的使用等。
这是看网站的代码是怎么优化的,div+CSS是怎么用的。网页结构框架的分析主要看网站的布局和是否有框架。使用什么样式表,外部的还是内部的。js的使用,合理使用js可以减少网页的源码,但是如果合理大量使用,会影响网页的爬取。
第三,查看网站 的卷、外部链接和快照。
条目数可以反映网站是否受搜索引擎欢迎,也可以判断网站内容的原创程度。看外链可以反映其他网站对网站的评价。此外,查看外部链接的来源也很重要。不同来源对网站促销的权重不同。因此,外链建设不仅要做到数量,还要做到质量。快照可以反映来自 网站 的更新。只有当网站内容更新频繁,是原创信息时,对搜索引擎友好的网站才会吸引搜索引擎蜘蛛去爬。
第四,看关键词的排名。
关键词的排名主要从网站的主键和长尾关键词考虑。做过seo的人都知道,有时候自己排名的关键词不做,有些不刻意做的词也会排名很好。所以这个要综合考虑。当然,主关键词的排名越高,SEO越好,关键词的选择也是合理的,更能体现执行力。
五、网站目录和内部链接的构建。
网站用了多少层,文件名怎么写。尽量不要让用户花费大量精力,多次点击,找到自己想要的东西。最好不超过四个。另外,网站的内链建设也很重要,可以通过关键词进行内链建设。首页与其他页面的关系如何,目录页与其他页面的关系如何?使内部页面链接紧密循环。
第六,看关键词的布局和header标签。
选择关键词时,主关键词和长尾关键词都被选中。(如何深挖关键词)所以考虑到关键词的分布可以反映SEO做得有多好。关键词的位置、频次、标签等,比如关键词是加粗还是下划线等设置图片的alt,依此类推。
以上是分享的尝鲜网站seo诊断分析。SEO诊断是指SEO在优化网站之前对网站整体情况的诊断。就像医生看病人一样,必须先“看、闻、问、摸”,才能知道病人的病情。同样,seo必须先诊断网站,写一个网站诊断,然后对内优化网站,对外推广。
官方数据:数据采集实战:动态网页数据采集
Part1简介
在上一条推文中,我们已经解释了静态网页的 采集 方法。在本文中,我们介绍动态网页的方法采集。
本文采集的例子网站为:我们的目标是采集网页中指定的文字信息,并保存。
完整代码见文末附件!
Part2 什么是动态网页
通常,我们要提取的数据不在我们下载的 HTML 源代码中。比如我们刷QQ空间或者微博评论的时候,一直往下滑,网页不刷新就会越来越长,内容越来越多。
具体来说,当我们浏览网站时,用户的实际操作(如向下滚动鼠标滚轮加载内容)不断向服务器发起请求,并使用JavaScript技术将返回的数据转换成新的内容添加到网页。以百度图片为例:我们输入百度图片后,搜索我们想找的图片,然后不断向下滚动页面。我们会看到网页中不断加载图片,但是网页没有刷新。这个动态加载页面。
Part3 手册采集操作步骤
本文中采集的例子网站为: 内容如下图所示:
假设我们需要采集的内容是:文章的标题,关键词,这4部分的发布日期和详情链接,对于标题的3部分,关键词,发布日期信息我们可以在列表页面上看到。详情链接,我们还需要点击网站到采集上的指定详情页面,如下图:
假设我们要采集有很多内容,单独手动采集操作会浪费很多时间,那么我们可以使用Python来自动化采集数据。
Part4 自动采集的步骤(一)动态加载页面分析
在不刷新网页的情况下,网站需要点击网页末尾的按钮来加载新数据,如下图所示:
我们打开开发者工具(谷歌浏览器按F12),点击过滤器XHR,然后多次点击网页底部的按钮加载内容。我们可以看到,每次点击按钮,我们都可以抓包,我们查看抓包信息,可以发现请求返回的响应内容中收录了我们想要的数据。实际操作如下:
网页中显示的内容:
所以我们可以直接请求这个接口来获取我们想要的数据。我们首先提取这三个不同请求的URL,如下图:
第2页:https://www.xfz.cn/api/website/articles/?p=2&n=20&type=<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />第3页:https://www.xfz.cn/api/website/articles/?p=3&n=20&type=<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />第4页:https://www.xfz.cn/api/website/articles/?p=4&n=20&type=
提示:此 URL 是带有参数的 GET 请求。域名和参数用?分隔,每个参数用&分隔。
我们观察每个页面的 URL 参数的变化,发现 p 是三个参数中的一个可变参数。我们每点击一次,p就加1,所以p参数和翻页有关。我们可以通过修改 p 参数来访问它。从不同页面的信息内容我们也可以推断,当p参数的值为1时,就是请求网站的第一页的内容。
(二)代码实现 1.请求页面并解析数据
import requests<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />import time<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />for page in range(1, 6): # 获取5页数据<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 利用format构造URL<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> url = 'https://www.xfz.cn/api/website/articles/?p={}&n=20&type='.format(page)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 发送请求获取响应<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> res = requests.get(url=url)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 将响应的json格式字符串,解析成为Python字典格式<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> info_dic = res.json()<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 提取我们想要的数据,并格式化输出<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> for info in info_dic['data']:<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> result = {<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'title': info['title'],<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'date': info['time'],<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'keywords': '-'.join(info['keywords']),<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'href': 'https://www.xfz.cn/post/' + str(info['uid']) + '.html'<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> print(result)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> time.sleep(1) # 控制访问频率<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />
执行结果(部分):
{'title': '「分贝通」完成C+轮1.4亿美元融资', 'date': '2022-02-17 10:17:13', 'keywords': '分贝通-DST Global', 'href': 'https://www.xfz.cn/post/10415.html'}<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />{'title': '「塬数科技」完成近亿元A轮融资,凡卓资本担任独家财务顾问', 'date': '2022-02-15 10:17:42', 'keywords': '塬数科技-凡卓资本-晨山资本-博将资本', 'href': 'https://www.xfz.cn/post/10412.html'}<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />{'title': '「BUD」获1500万美元A+轮融资', 'date': '2022-02-14 10:15:35', 'keywords': '启明创投-源码资本-GGV纪源资本-云九资本', 'href': 'https://www.xfz.cn/post/10411.html'}<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />{'title': '以图计算引擎切入千亿级数据分析市场,它要让人人成为分析师,能否造就国内百亿级黑马', 'date': '2022-02-10 11:04:52', 'keywords': '欧拉认知智能-新一代BI', 'href': 'https://www.xfz.cn/post/10410.html'}<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />{'title': '前有Rivian市值千亿,后有经纬、博原频频押注,滑板底盘赛道将诞生新巨头?丨什么值得投', 'date': '2022-02-09 11:51:36', 'keywords': '什么值得投', 'href': 'https://www.xfz.cn/post/10409.html'}<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />
2.保存到本地csv
在原代码的基础上,我们添加了一点内容,并将我们爬取的内容保存到一个CSV文件中。有很多方法可以将其保存到 CSV 文件。这里我们使用pandas的第三方模块来实现,需要pip install pandas。安装。
import requests<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />import time<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />import pandas as pd # 导入模块<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /># 创建一个数据集,用来保存数据<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />data_set = [<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> ('标题', '日期', '关键词', '详情链接'), # 这边先定义头部内容<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />]<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />for page in range(1, 6): # 获取5页数据<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 利用format构造URL<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> url = 'https://www.xfz.cn/api/website/articles/?p={}&n=20&type='.format(page)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 发送请求获取响应<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> res = requests.get(url=url)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 将响应的json格式字符串,解析成为Python字典格式<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> info_dic = res.json()<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 提取我们想要的数据,并格式化输出<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> for info in info_dic['data']:<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> result = {<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'title': info['title'],<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'date': info['time'],<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'keywords': '/'.join(info['keywords']), # 关键词会含有多个,每个关键词用斜杠隔开<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'href': 'https://www.xfz.cn/post/' + str(info['uid']) + '.html' # 构造详情页url<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 获取字典里面的值,并转换成列表<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> info_list = list(result.values())<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 添加到数据集<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> data_set.append(info_list)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> time.sleep(1) # 控制访问频率<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /># 保存成为csv文件<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />df = pd.DataFrame(data_set)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />df.to_csv('xfz.csv', mode='a', encoding='utf-8-sig', header=False, index=False)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />
执行结果(部分):
Part5总结
文中介绍了动态网站data采集的基本流程和方法,结合上期我们讲的静态网页数据采集实战,相信大家已经掌握了数据采集基本功。那么返回的数据采集 呢?请继续关注下一条推文:Python 数据处理的基础知识。
附件:get_web_data.py
import requests<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />import time<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />import pandas as pd # 导入模块<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /># 创建一个数据集,用来保存数据<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />data_set = [<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> ('标题', '日期', '关键词', '详情链接'), # 这边先定义头部内容<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />]<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />for page in range(1, 6): # 获取5页数据<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 利用format构造URL<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> url = 'https://www.xfz.cn/api/website/articles/?p={}&n=20&type='.format(page)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 发送请求获取响应<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> res = requests.get(url=url)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 将响应的json格式字符串,解析成为Python字典格式<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> info_dic = res.json()<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 提取我们想要的数据,并格式化输出<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> for info in info_dic['data']:<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> result = {<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'title': info['title'],<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'date': info['time'],<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'keywords': '/'.join(info['keywords']), # 关键词会含有多个,每个关键词用斜杠隔开<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> 'href': 'https://www.xfz.cn/post/' + str(info['uid']) + '.html' # 构造详情页url<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 获取字典里面的值,并转换成列表<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> info_list = list(result.values())<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> # 添加到数据集<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> data_set.append(info_list)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> time.sleep(1) # 控制访问频率<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /># 保存成为csv文件<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />df = pd.DataFrame(data_set)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />df.to_csv('xfz.csv', mode='a', encoding='utf-8-sig', header=False, index=False)<br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />