-
Notifications
You must be signed in to change notification settings - Fork 242
Closed
Description
Library version
1.2.7
Describe the bug
The 'appId' (and also the url) doesn't get returned for the most popular app returned from the webpage. For example some specific search like (amazon/whatsapp) will have a webpage that the main app is (amazon shopping / whatsapp messanger) but for those the appid/url are none.
Rest of the apps in the page returned fine. This happens only when the webpage looks like the following:
This won't happen when you search some generic search query like the following:
Code
from google_play_scraper import search
def get_app_details():
query = "whatsapp" # π Hardcoded query
max_results = 30
print(f"π Searching Google Play Store for: {query}")
results = search(query, lang='en', country='us', n_hits=max_results)
apps = []
for app in results:
title = app.get('title', 'Unknown')
category = app.get('genre', 'Unknown')
# Some versions return appId, some return url only
app_id = app.get('appId')
url = app.get('url')
# Try to reconstruct missing data
if not app_id and url and "id=" in url:
app_id = url.split("id=")[-1]
elif not app_id and 'https://play.google.com' not in str(url):
# Some versions return a partial path instead of full URL
if isinstance(url, str) and "id=" in url:
app_id = url.split("id=")[-1]
# If still missing, try guessing from title (not ideal but fallback)
if not app_id:
app_id = "Unknown"
# Construct URL if missing
if not url or url == "None" or not isinstance(url, str):
if app_id != "Unknown":
url = f"https://play.google.com/store/apps/details?id={app_id}"
else:
url = "Unknown"
apps.append((title, app_id, category, url))
# Print results
print("\nπ± Apps Found:")
for title, app_id, category, url in apps:
print(f"- {title}\n ID: {app_id}\n Category: {category}\n URL: {url}\n")
return apps
if __name__ == "__main__":
get_app_details()
Expected behavior
it should return the appid/url just like any other app
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels