Google Play 商店自动提示?

Google Play Store autosuggest?

有了Google,你可以使用google.com/complete/search?output=toolbar&q= (+keyword) 得到Google 提出的所有建议的列表您开始在 Google 的搜索栏中输入内容。

即google.com/complete/search?output=toolbar&q=python 将 return:

python dictionary
python programming
python tutorial

等等

Google Play 商店是否存在同样的东西?我没找到。

如果没有,我想我可以尝试使用 GPS'html...但这听起来很难。

使用 Chrome 开发工具,我发现更改 Google Play 上搜索框的值会向此 URL:

发送请求
https://market.android.com/suggest/SuggRequest?json=1&query=<term>

<term> 替换为您的搜索词 returns 一些 JSON 数据,其中包含我们的自动建议结果。例如,使用 query=python returns 这个 JSON:

[{"s":"python","t":"q"},
 {"s":"python for android","t":"q"},
 {"s":"python programming","t":"q"},
 {"s":"python idle","t":"q"},
 {"s":"python ide","t":"q"}]

使用 requests 库,然后很容易将此 JSON 解析为 Python 列表:

import requests

req = requests.get("https://market.android.com/suggest/SuggRequest?json=1&query=python")
data = req.json()
results = [x["s"] for x in data]

print(results) # ['python', 'python for android', 'python programming', 'python idle', 'python ide']