| """Extract data for a single application.""" | |
| from typing import Dict | |
| from google_play_scraper.utils.http_utils import get | |
| from google_play_scraper.constants.google_play import APP_URL_FORMAT | |
| from google_play_scraper.constants.element import APP_SELECTORS | |
| def app(app_id: str, lang: str = "en", country: str = "us") -> Dict: | |
| """Get app details by ID.""" | |
| url = APP_URL_FORMAT.format(app_id=app_id, lang=lang, country=country) | |
| response = get(url) | |
| data = {} | |
| for key, selector in APP_SELECTORS.items(): | |
| data[key] = response.get(selector) | |
| return data |