From 9bed61f54774821b68c08e840ea0ca67f7ef52a0 Mon Sep 17 00:00:00 2001 From: dri-mobisec <119871132+dri-mobisec@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:49:29 +0100 Subject: [PATCH 1/3] fix: top_result was not correctly fetched MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now fetch array dataset["ds:4˝][0][1][1]... ] because item 0 now contains a disclaimer about the search results instead of the top result --- google_play_scraper/features/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google_play_scraper/features/search.py b/google_play_scraper/features/search.py index f697d76..f15c7f8 100644 --- a/google_play_scraper/features/search.py +++ b/google_play_scraper/features/search.py @@ -38,7 +38,7 @@ def search( dataset[key] = value try: - top_result = dataset["ds:4"][0][1][0][23][16] + top_result = dataset["ds:4"][0][1][1][23][16] except IndexError: top_result = None From f0aa638702185502c99fa394928ca255f8d6854a Mon Sep 17 00:00:00 2001 From: Cristiano Dri Date: Tue, 19 Nov 2024 13:05:59 +0100 Subject: [PATCH 2/3] fix: added TypeError catch to top_result in search --- google_play_scraper/features/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google_play_scraper/features/search.py b/google_play_scraper/features/search.py index f15c7f8..f5bc374 100644 --- a/google_play_scraper/features/search.py +++ b/google_play_scraper/features/search.py @@ -39,7 +39,7 @@ def search( try: top_result = dataset["ds:4"][0][1][1][23][16] - except IndexError: + except IndexError | TypeError: top_result = None success = False From ecac29ee90af23b9d79e128b3d131db3d79037fc Mon Sep 17 00:00:00 2001 From: Cristiano Dri Date: Tue, 19 Nov 2024 14:13:08 +0100 Subject: [PATCH 3/3] fix: subsituted TypeError with generic Exception in search top_result --- google_play_scraper/features/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google_play_scraper/features/search.py b/google_play_scraper/features/search.py index f5bc374..cf049a8 100644 --- a/google_play_scraper/features/search.py +++ b/google_play_scraper/features/search.py @@ -39,7 +39,7 @@ def search( try: top_result = dataset["ds:4"][0][1][1][23][16] - except IndexError | TypeError: + except Exception: top_result = None success = False