python - How to scrape star ratings using Selenium or Beautifulsoup in Python?
问题描述
I am trying to scrape the ratings based on stars. The stars are in different colors and can be distinguished in Chrome. However, the stars are all the same in the tags. Is there a way to scrape the rating for each sub-category based on the color of the stars, e.g., Work/Life Balance should have a rating of 3.
The webpage can be found here: https://www.glassdoor.ca/Reviews/Employee-Review-AAR-RVW40036525.htm
解决方案
为了区分评级,每个评级类别的类名称都不同。这是一个基于等级的所有类名的示例,值是类名。这可以让你从你需要的东西开始
{
"one_star" : "css-152xdkl",
"two_star" : "css-19o85uz",
"three_star" : "css-1ihykkv",
"four_star" : "css-1c07csa",
"five_star" : "css-1dc0bv4",
}
推荐阅读
- java - 代码执行时间非常长
- crystal-lang - 带有可选 splat 参数的 HTTP 客户端帖子未编译
- java - 执行 GC 程序时出现 NPE 错误,有人可以纠正我吗?
- visual-c++ - 从命令提示符向 MFC GUI 应用程序提供参数
- ios - Swift iOS -Constraint 没有动画,即使 view.layoutIfNeeded() 被调用
- java - mvn clean install intellij - compile error - can not find symbol
- mysql - 我想在交易日期之间输出库存,如果没有交易日期,它仍应在 MySQL 上显示库存系统的所有库存
- rest - REST API 子资源设计
- node.js - 在 Mocha 测试中侦听 stdout 时“此套接字已关闭”
- android - 在 ARCore 中放置具有给定罗盘方位的对象