def get_badges(page): stlib.logger.info('Getting badges from page %d', page) profile = stlib.steam_profile() html = stlib.network.try_get_html('steam', '{}/badges/?p={}'.format(profile, page)) return html.findAll('div', class_='badge_title_row')
def get_badge_page_count(): stlib.logger.info('Counting badge pages') profile = stlib.steam_profile() html = stlib.network.try_get_html('steam', '{}/badges/'.format(profile)) try: page_count = int(html.findAll('a', class_='pagelink')[-1].text) except IndexError: page_count = 1 return page_count
def get_card_count(badge, update_from_web=False): game_name = get_game_name(badge) game_id = get_game_id(badge) if update_from_web: stlib.logger.verbose('Updating number of cards of %s(%s)', game_name, game_id) profile = stlib.steam_profile() html = stlib.network.try_get_html('steam', '{}/gamecards/{}'.format(profile, game_id)) stats = html.find('div', class_='badge_title_stats_drops') progress = stats.find('span', class_='progress_info_bold') else: stlib.logger.verbose('Getting number of cards of %s(%s)', game_name, game_id) progress = badge.find('span', class_='progress_info_bold') if not progress or 'No' in progress.text: return 0 else: return int(progress.text.split(' ', 3)[0])
def get_card_count(badge, update_from_web=False): game_name = get_game_name(badge) game_id = get_game_id(badge) if update_from_web: stlib.logger.verbose('Updating number of cards of %s(%s)', game_name, game_id) profile = stlib.steam_profile() html = stlib.network.try_get_html( 'steam', '{}/gamecards/{}'.format(profile, game_id)) stats = html.find('div', class_='badge_title_stats_drops') progress = stats.find('span', class_='progress_info_bold') else: stlib.logger.verbose('Getting number of cards of %s(%s)', game_name, game_id) progress = badge.find('span', class_='progress_info_bold') if not progress or 'No' in progress.text: return 0 else: return int(progress.text.split(' ', 3)[0])