Added API to fetch search suggestions

This commit is contained in:
Domenico Iezzi 2018-04-06 20:47:58 +02:00
parent 2247d2386e
commit 9a9ba1434a
No known key found for this signature in database
GPG Key ID: 7AC94D5DDA2FB7EE
3 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ build/
dist/
*.egg-info/
.idea/
.venv/

View File

@ -300,6 +300,17 @@ class GooglePlayAPI(object):
return message
def searchSuggest(self, query):
params = {"c": "3",
"q": requests.utils.quote(query),
"ssis": "120",
"sst": "2"}
data = self.executeRequestApi2("searchSuggest", params=params)
response = data.payload.searchSuggestResponse
return [{"type": e.type,
"suggestedQuery": e.suggestedQuery,
"title": e.title} for e in response.entry]
def search(self, query, nb_result, offset=None):
""" Search the play store for an app.

View File

@ -26,6 +26,9 @@ server.login(None, None, gsfId, authSubToken)
apps = server.search('telegram', 34, None)
print('\nSearch suggestion for "fir"\n')
print(server.searchSuggest('fir'))
print('nb_result: 34')
print('number of results: %d' % len(apps))