android - 爬行的Google Play商店应用

标签 android python-3.x google-play web-crawler

我想抓取Google Play商店并获取特定类别的所有应用ID。当我执行以下代码时,我得到的前49个应用程序的应用程序ID不超过此。但我想获取所有应用程序ID。我该如何实现?
我使用的URL是https://play.google.com/store/search?q=sports&c=apps&hl=en进行抓取。

import urllib.request, urllib.error, urllib.parse
from bs4 import BeautifulSoup

url=input('Enter:')
html=urllib.request.urlopen(url).read()
soup=BeautifulSoup(html,'html.parser')

tags=soup('a')
l=list()
for tag in tags:
    x=tag.get('href',None)
    if x.find("/store/apps/details?id=")!=-1:
       if not(x[23:] in l):
            l.append(x[23:])
print(l)

最佳答案

在这样的动态站点上,最好使用内部XHR获取数据而不是解析html。每个显示的48个应用都有一个POST请求,您可以从脚本中调用该请求。 In this blog post是如何以这种方式从Google Play商店获取应用评论的示例。

关于android - 爬行的Google Play商店应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52151644/

相关文章:

android - 如何在 RecyclerView.Adapter 中使用共享首选项?

java - 带有清除按钮的 Android java android.support.design.widget.TextInputLayout

android - Admob xml : the following classes could not be instantiated: - com. google.android.gms.ads.AdView

android - 如何在 Android Studio 3.0.0 中使用数据绑定(bind)和 Kotlin

python - 如何判断两个元素是否属于同一个列表

python - ImportError - 在 CircleCI 上测试失败但在本地通过

Python-Youtube-Api : Missing code parameter in response

android - Instant App 在上传到生产环境时显示问题

android - 在 Google Play 上更新 Android 应用 - Android 开发者控制台

android - 检查以前消费的商品