File size: 588 Bytes
b1a96d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""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