代码改变世界

网页搜索返回结果元素分析

2022-04-03 14:05  钱先生  阅读(117)  评论(0编辑  收藏  举报

转自https://www.yesdotnet.com/archive/post/1638553966.html

 

百度搜索结果列表html元素分析


第一种

百度搜索结果列表html元素分析

百度搜索结果列表html元素分析

这个结果中class也包含了result,但是没有new-pmd

第二种

百度搜索结果列表html元素分析

底部相关搜索

百度搜索结果列表html元素分析

正常的结果如图所示

 

百度搜索结果列表html元素分析

 

百度广告

百度搜索结果列表html元素分析

 

百度汉语

百度搜索结果列表html元素分析

 

百度百科

百度搜索结果列表html元素分析

爱采购

百度搜索结果列表html元素分析

百度贴吧

百度搜索结果列表html元素分析

样式汇总

正常内容 result c-container new-pmd
gitee.com c-container result
中间的他人搜索 result-op c-container new-pmd
底部相关搜索 result-molecule new-pmd
广告,父级就一个div包起来,没有样式  
百度汉语 result-op c-container new-pmd
百度百科 result-op c-container xpath-log new-pmd
爱采购 result-op c-container xpath-log new-pmd
百度贴吧 result-op c-container xpath-log new-pmd

正确的定位方法

results = html.find("#content_left .result.new-pmd")

 

版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接