Skip to content

[BUG] 'appId': None in some apps even if it's existing in browserΒ #238

@liranjp

Description

@liranjp

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:

Image This won't happen when you search some generic search query like the following: Image

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions