def process_item(self, item, spider): if self.__class__ in spider.pipeline: with Persistor() as persistor: persistor.store_app_id(item) return item else: return item
def scrape_owned_apps(steam_id): """Scrapes all owned games for a user as reported by querying the database. Args: steam_id (str | int): steam id of the user to scrape ownership for. """ with Persistor() as persistor: scrape_steam_apps(persistor.get_owned_app_ids(steam_id))
def all_games(): steam_id = request.args.get('steam_id') with Persistor() as persistor: if steam_id is None: apps_info = persistor.get_all_apps_info() else: apps_info = persistor.get_owned_app_info(steam_id) app_info_unicode = [app_info.to_unicode_list() for app_info in apps_info] return render_template('apps.html', apps_info_json=json.dumps(app_info_unicode))
def scrape_steam_powered_owned_app_pages(steam_id): with Persistor() as persistor: scrape_steam_powered_app_pages(persistor.get_owned_app_ids(steam_id))
def scrape_apps_with_unknown_points(): """Scrapes all games in database with unknown point values""" with Persistor() as persistor: scrape_steam_apps(persistor.get_app_ids_for_unknown_points())