def main(): # 获取登录状态 steam_class = steam.Steam(need_login=False) # 已删除的游戏 restricted_app_list = steam_class.load_restricted_app_list() output.print_msg(f"总共获取{len(restricted_app_list)}个已受限游戏") result_game_ids = [] while len(restricted_app_list) > 0: game_id = restricted_app_list.pop() output.print_msg(f"游戏:{game_id},剩余数量:{len(restricted_app_list)}") # 获取游戏信息 try: game_data = steam.get_game_store_index(game_id) except crawler.CrawlerException as e: output.print_msg(e.http_error(f"游戏{game_id}")) continue if game_data["error"]: output.print_msg(f"游戏 {game_id} 访问错误,{game_data['error']}") result_game_ids.append(game_id) elif game_data["restricted"] is False: output.print_msg(f"游戏 {game_id} 不在已受限列表中") result_game_ids.append(game_id) output.print_msg(result_game_ids) restricted_app_list = steam_class.load_restricted_app_list() for game_id in result_game_ids: restricted_app_list.remove(game_id) steam_class.save_restricted_app_list(restricted_app_list)
def main(): # 获取登录状态 steam_class = steam.Steam(need_login=False) # 已删除的游戏 deleted_app_list = steam_class.load_deleted_app_list() output.print_msg(f"总共获取{len(deleted_app_list)}个已删除游戏") result_game_ids = [] while len(deleted_app_list) > 0: game_id = deleted_app_list.pop() output.print_msg(f"游戏:{game_id},剩余数量:{len(deleted_app_list)}") # 获取游戏信息 try: game_data = steam.get_game_store_index(game_id) except crawler.CrawlerException as e: output.print_msg(e.http_error(f"游戏{game_id}")) continue if game_data["deleted"] is False: output.print_msg(f"游戏 {game_id} 不在已删除列表中") result_game_ids.append(game_id) output.print_msg(result_game_ids)
def main(): # 获取登录状态 steam_class = steam.Steam(need_login=False) # 已删除的游戏 deleted_app_list = steam_class.load_deleted_app_list() try: banned_game_list = madjoki.get_banned_game_list() except crawler.CrawlerException as e: output.print_msg(e.http_error("已下线游戏列表")) else: output.print_msg(f"总共获取{len(banned_game_list)}个已删除游戏") banned_game_id_list = {} for game_info in banned_game_list: banned_game_id_list[str(game_info["game_id"])] = 1 for game_id in deleted_app_list: if game_id not in banned_game_id_list: # 获取游戏信息 try: game_data = steam.get_game_store_index(game_id) except crawler.CrawlerException as e: output.print_msg(e.http_error(f"游戏{game_id}")) continue if game_data["deleted"] is False: output.print_msg(f"游戏 {game_id} 不在已删除列表中")
def main(): # 获取登录状态 steam_class = steam.Steam(need_login=True) # 所有打折游戏 discount_game_file_path = os.path.abspath(os.path.join(steam_class.cache_data_path, "discount.txt")) discount_game_list = tool.json_decode(file.read_file(discount_game_file_path), []) game_id_list = [] for game_info in discount_game_list: if game_info["type"] == "game": game_id_list.append(game_info["app_id"]) else: game_id_list += game_info["app_id"] # 已检测过的游戏列表 checked_apps_file_path = os.path.join(steam_class.cache_data_path, "discount_checked.txt") checked_apps_string = file.read_file(checked_apps_file_path) if checked_apps_string: checked_apps_list = checked_apps_string.split(",") else: checked_apps_list = [] # 已删除的游戏 deleted_app_list = steam_class.load_deleted_app_list() # 已资料受限制的游戏 restricted_app_list = steam_class.load_restricted_app_list() # 游戏的DLC列表 game_dlc_list = steam_class.load_game_dlc_list() while len(game_id_list) > 0: game_id = game_id_list.pop() game_id = str(game_id) if game_id[-1:] != "0": continue if game_id in deleted_app_list or game_id in restricted_app_list: continue if game_id in checked_apps_list: continue output.print_msg(f"游戏:{game_id},剩余数量:{len(game_id_list)}") # 获取游戏信息 try: game_data = steam.get_game_store_index(game_id) except crawler.CrawlerException as e: output.print_msg(e.http_error(f"游戏{game_id}")) continue if len(game_data["dlc_list"]) > 0: output.print_msg(f"游戏:{game_id}全部DLC:{game_data['dlc_list']}") is_change = False for dlc_id in game_data["dlc_list"]: if dlc_id not in game_dlc_list: is_change = True game_dlc_list[dlc_id] = game_id # 保存数据 if is_change: steam_class.save_game_dlc_list(game_dlc_list) # 已资料受限制 if game_data["restricted"]: output.print_msg(f"游戏:{game_id}已资料受限制") restricted_app_list.append(game_id) # 保存数据 steam_class.save_restricted_app_list(restricted_app_list) # 增加检测标记 checked_apps_list.append(game_id) file.write_file(",".join(checked_apps_list), checked_apps_file_path, file.WRITE_FILE_TYPE_REPLACE)
def main(check_game=True): # 获取登录状态 steam_class = steam.Steam(need_login=True) # 历史记录 apps_cache_data = steam_class.load_cache_apps_info() # 已检测过的游戏列表 checked_apps_file_path = os.path.join(steam_class.cache_data_path, "review_checked.txt") checked_apps_string = file.read_file(checked_apps_file_path) if checked_apps_string: checked_apps_list = checked_apps_string.split(",") else: checked_apps_list = [] # 已删除的游戏 deleted_app_list = steam_class.load_deleted_app_list() # 已资料受限制的游戏 restricted_app_list = steam_class.load_restricted_app_list() # 游戏的DLC列表 game_dlc_list = steam_class.load_game_dlc_list() # 获取自己的全部玩过的游戏列表 try: played_game_list = steam.get_account_owned_app_list( steam_class.account_id, True) except crawler.CrawlerException as e: output.print_msg(e.http_error("个人游戏主页")) raise if check_game: while len(played_game_list) > 0: game_id = played_game_list.pop() if game_id in deleted_app_list: continue if game_id in checked_apps_list: continue output.print_msg(f"开始解析游戏 {game_id},剩余数量:{len(played_game_list)}") # 获取游戏信息 try: game_data = steam.get_game_store_index(game_id) except crawler.CrawlerException as e: output.print_msg(f"游戏 {game_id} 解析失败,原因:{e.message}") output.print_msg(e.http_error(f"游戏{game_id}")) continue is_change = False # 已删除 if game_data["deleted"]: deleted_app_list.append(game_id) # 保存数据 steam_class.save_deleted_app_list(deleted_app_list) else: # 有DLC的话,遍历每个DLC for dlc_id in game_data["dlc_list"]: # 已经评测过了,跳过检查 if dlc_id in apps_cache_data["review_list"]: continue # DLC和游戏本体关系字典 if dlc_id not in game_dlc_list: game_dlc_list[dlc_id] = game_id is_change = True # 获取DLC信息 try: dlc_data = steam.get_game_store_index(dlc_id) except crawler.CrawlerException as e: output.print_msg(e.http_error(f"游戏{dlc_id}")) continue if dlc_data["owned"]: # 已经评测过了 if dlc_data["reviewed"]: # 从待评测列表中删除 if dlc_id in apps_cache_data["can_review_lists"]: apps_cache_data["can_review_lists"].remove( dlc_id) # 增加已评测记录 if dlc_id not in apps_cache_data["review_list"]: apps_cache_data["review_list"].append(dlc_id) # 新的可以评测游戏 else: if dlc_id not in apps_cache_data[ "can_review_lists"]: apps_cache_data["can_review_lists"].append( dlc_id) # 已经评测过了 if game_data["reviewed"]: # 从待评测列表中删除 if game_id in apps_cache_data["can_review_lists"]: apps_cache_data["can_review_lists"].remove(game_id) # 增加已评测记录 if game_id not in apps_cache_data["review_list"]: apps_cache_data["review_list"].append(game_id) # 新的可以评测游戏 else: if game_id not in apps_cache_data["can_review_lists"]: apps_cache_data["can_review_lists"].append(game_id) if is_change: steam_class.save_game_dlc_list(game_dlc_list) # 已资料受限制 if game_data["restricted"]: if game_id not in restricted_app_list: restricted_app_list.append(game_id) # 保存数据 steam_class.save_restricted_app_list( restricted_app_list) # 增加检测标记 steam_class.save_cache_apps_info(apps_cache_data) # 保存数据 checked_apps_list.append(game_id) file.write_file(",".join(checked_apps_list), checked_apps_file_path, file.WRITE_FILE_TYPE_REPLACE) # 输出 print_list(apps_cache_data, game_dlc_list)
def main(): # 获取登录状态 steam_class = steam.Steam(need_login=True) # 获取自己的全部游戏列表 try: owned_game_list = steam.get_account_owned_app_list(steam_class.account_id) except crawler.CrawlerException as e: output.print_msg(e.http_error("个人游戏主页")) raise # 已检测过的游戏列表 checked_apps_file_path = os.path.join(steam_class.cache_data_path, "checked.txt") checked_apps_string = file.read_file(checked_apps_file_path) if checked_apps_string: checked_apps_list = checked_apps_string.split(",") else: checked_apps_list = [] # 已删除的游戏 deleted_app_list = steam_class.load_deleted_app_list() # 已资料受限制的游戏 restricted_app_list = steam_class.load_restricted_app_list() # 游戏的DLC列表 game_dlc_list = steam_class.load_game_dlc_list() while len(owned_game_list) > 0: game_id = owned_game_list.pop() if game_id in checked_apps_list: continue output.print_msg(f"游戏: {game_id},剩余数量: {len(owned_game_list)}") # 获取游戏信息 try: game_data = steam.get_game_store_index(game_id) except crawler.CrawlerException as e: output.print_msg(e.http_error(f"游戏 {game_id}")) raise # 已删除 if game_data["deleted"]: output.print_msg(f"游戏 {game_id} 已删除") if game_id not in deleted_app_list: deleted_app_list.append(game_id) # 保存数据 steam_class.save_deleted_app_list(deleted_app_list) else: # 受限制 if game_data["restricted"]: output.print_msg(f"游戏 {game_id} 已受限制") if game_id not in restricted_app_list: restricted_app_list.append(game_id) # 保存数据 steam_class.save_restricted_app_list(restricted_app_list) # 所有的DLC if len(game_data["dlc_list"]) > 0: is_change = False for dlc_id in game_data["dlc_list"]: output.print_msg(f"游戏 {game_id},DLC {dlc_id}") if dlc_id not in game_dlc_list: game_dlc_list[dlc_id] = game_id # 保存数据 if is_change: steam_class.save_game_dlc_list(game_dlc_list) checked_apps_list.append(game_id) file.write_file(",".join(checked_apps_list), checked_apps_file_path, file.WRITE_FILE_TYPE_REPLACE)