JoMingyu/google-play-scraper

[BUG] European countries not working for Google Play Search

akg745 opened this issue · 3 comments

Library version: 1.2.6

Describe the bug
Using Google Play Search module with all European countries fails (e.g. country = 'fr' / 'be' / 'cz' / 'bg' / 'at'), error message:


TypeError Traceback (most recent call last)
Cell In[137], line 34
31 for keyword in keywords:
32 # try:
33 keyword = keyword.lower()
---> 34 results = search(keyword, country=country, n_hits=10)
35 for result in results:
36 app_difficulty = 0

File ~\Anaconda\lib\site-packages\google_play_scraper\features\search.py:41, in search(query, n_hits, lang, country)
38 dataset[key] = value
40 try:
---> 41 top_result = dataset["ds:4"][0][1][0][23][16]
42 except IndexError:
43 top_result = None

TypeError: 'NoneType' object is not subscriptable

Code
Copy and paste the code that have issue.

results = search("tax", country="de", n_hits=10)
results = search("tax", country="fr", n_hits=10)
results = search("tax", country="cz", n_hits=10)

Basically all EU countries have this bug

Additional context
Other countries work fine!

Update: I have managed to fix this, it's a very easy fix to add another Error type (TypeError) in the Exception handling on the search function. Happy to all send in a PR to fix it if possible and if it saves @JoMingyu time!