抓取Google Play商店应用

问题描述 投票:1回答:2

我想抓取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)
android python-3.x google-play web-crawler
2个回答
1
投票

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


0
投票

尝试使用为此定制的Web服务,如:

https://www.apify.com/

看看他们的python3样本:https://github.com/yonnyZer0/apify-python3-example/

© www.soinside.com 2019 - 2024. All rights reserved.