Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, input_dir: str, output_dir: str):

self.toplist_pattern = re.compile(r"\[(\d{2}:\d{2}:\d{2})].*?#(\d+)\s+([^\[]+)")
self.crate_open_pattern = re.compile(
r"\b(?:ffnest eine crate vom typ|you are opening a crate of the type) ([^\[]+)\b",
r"\b(?:öffnest eine crate vom typ|you are opening a crate of the type) ([^\[]+)\b",
re.IGNORECASE
)
self.crate_drop_pattern = re.compile(
Expand Down Expand Up @@ -115,7 +115,7 @@ def process_archive(self, archive: str) -> None:

try:
archive_path = os.path.join(self.input_dir, archive)
with gzip.open(archive_path, "rt", errors="replace") as log_file:
with gzip.open(archive_path, "rt", encoding="utf-8", errors="replace") as log_file:
for line in log_file:
self.process_line(line, date)
print(f"Finished {archive}")
Expand Down Expand Up @@ -158,12 +158,11 @@ def __handle_toplist(self, line: str, date_time: str) -> bool:
return False

category = OutputType.Unsorted
if "Besuche" in info or "visits" in info:
if "Besuch" in info or "visit" in info:
category = OutputType.Warp
elif "$" in info:
category = OutputType.Guild
elif "Level" in info:
info = info.replace("?", "★")
category = OutputType.Level
elif "Job-XP" in info or "Job XP" in info:
category = OutputType.Job
Expand Down