在google playstore中使用Python查找所有jscontroller div

在google playstore中使用Python查找所有jscontroller div,python,beautifulsoup,Python,Beautifulsoup,我正在尝试从谷歌playstore的应用程序中获取所有评论。 我不能使用硒,所以我在考虑BeatifulSoup。 我的问题是,当我试图查找时,响应是[] 对于Selenium,我可以使用:driver.find\u elements\u by_xpath('//div[@jscontroller=“H6eOGe”]”)来实现这一点。 你的代码看起来不错。问题在于您得到的HTML。 如果您这样做: with open('source.html','w') as f: f.write(res

我正在尝试从谷歌playstore的应用程序中获取所有评论。 我不能使用硒,所以我在考虑BeatifulSoup。 我的问题是,当我试图查找
时,响应是
[]

对于Selenium,我可以使用:
driver.find\u elements\u by_xpath('//div[@jscontroller=“H6eOGe”]”)来实现这一点。


你的代码看起来不错。问题在于您得到的HTML。 如果您这样做:

with open('source.html','w') as f:
   f.write(response)
然后用文本编辑器打开该文件,您会注意到它不包含任何具有jscontroller=“H6eOGe”属性的div。 我猜这些div是在浏览器呈现页面时由脚本创建的

无论如何,您要查找的信息在HTML中,但是您必须以不同的方式解析它

with open('source.html','w') as f:
   f.write(response)