Last active
October 14, 2025 09:59
-
-
Save woctezuma/b0cebf57a76b10c0f6159baadac77470 to your computer and use it in GitHub Desktop.
Filter ASF log of removed F2P apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| LINE_PREFIXES = "app/" | |
| # https://steamcommunity.com/tradingcards/boostercreator/ | |
| BADGE_FNAME = "my_badges.json" | |
| LOG_PREFIX = "removeallfreepackages_" | |
| LOG_SUFFIX = "_filtered" | |
| LOG_EXTENSION = ".txt" | |
| def load_badges(): | |
| with open(BADGE_FNAME, encoding="utf-8") as f: | |
| data = json.load(f) | |
| return [badge["appid"] for badge in data] | |
| def load_log(username): | |
| with open(f"{LOG_PREFIX}{username}{LOG_EXTENSION}", encoding="utf-8") as f: | |
| return [line.strip() for line in f.readlines()] | |
| def filter_log(appids, lines): | |
| filtered_lines = [] | |
| for line in lines: | |
| if line.startswith(LINE_PREFIXES): | |
| appid = int(line.split()[0].split("/")[1]) | |
| if appid in appids: | |
| continue | |
| filtered_lines.append(line) | |
| return filtered_lines | |
| def write_log(username, filtered_lines): | |
| with open( | |
| f"{LOG_PREFIX}{username}{LOG_SUFFIX}{LOG_EXTENSION}", "w", encoding="utf-8" | |
| ) as f: | |
| f.write("\n".join(filtered_lines)) | |
| def main(): | |
| username = "wok" | |
| lines = load_log(username) | |
| appids = load_badges() | |
| filtered_lines = filter_log(appids, lines) | |
| write_log(username, filtered_lines) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment