作者chan15 (ChaN)
看板Python
标题[问题] Google Play 内容随机变动问题
时间Tue Mar 20 14:39:05 2018
各位好,小弟要抓取分析 Google Play 页面的星星数做分析
https://play.google.com/store/apps/details?id=jp.naver.line.android
以上面那个例子为例,要抓取如下方图示的位置
https://i.imgur.com/1dqIYT1.png
HTML 会像是 <span class="bar-number" aria-label="评分次数:30,554">30,554</span>
所以我是取 .bar-number 的部份,後来发现一个大问题
就是 Google 会随机的变更内容,会变成类似
<span class="UfW5d" aria-label="6,397,222 则评分">6,397,222</span>
用网页刷也是同样的情况,而用无痕就可以固定显示正确的 class
已经使用过无痕的 request header 也无效,不知道怎样让爬虫正确的抓到内容
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 59.124.224.43
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1521527948.A.F24.html
1F:→ s860134: 树状结构是稳定的,你找固定的文字作定位 xpath 相对路径 03/22 02:27
2F:→ s860134: 打个比方 <h2 class="Rm6Gwb">评论</h2> 03/22 02:28