def parseSearchPage(page): #we need to parse the resulting page to get the app we are looking for document = BeautifulSoup(page.text) cards = document.findAll(attrs={"class": "card"}) #we are looking for div with class set to 'card' if len(cards) > 0: #we need to get info on the first card/app we find card = cards[0] app = App() #let's do some html/css parsing app.name = card.find(attrs={"class": "title"}).get("title") logger.debug("Got the App's name") app.link = "https://play.google.com" + card.find(attrs={"class": "title"}).get("href") logger.debug("Got the App's link") price = card.find(attrs={"class": "display-price"}) if price is None: app.free = True else: app.free = None logger.debug("Got the App's price") app.rating = card.find(attrs={"class": "current-rating"})["style"].strip().replace("width: ","").replace("%","")[:3].replace(".","") #we get the rating, reading it from the style attribute logger.debug("Got the App's rating") #we also download the page of the app to check for IAP and more logger.debug("Downlaoding the App's page") app_page = requests.get(app.link) logger.debug("Analyzing the App's page") app_document = BeautifulSoup(app_page.text) iap_element = app_document.findAll(attrs={"class": "inapp-msg"}) if len(iap_element) > 0: app.IAP = True else: app.IAP = False logger.debug("Got the App's IAP status") return app else: return None