import re
import os
import html
# --- CONFIGURATION ---
INPUT_FILE = '/home/david/code/personal_development/sms/sms-20251127173937.xml'
OUTPUT_FILE = '/home/david/code/personal_development/sms/michelle_kifer_messages.txt'
TARGET_CONTACT_NAME = "Michelle 🔥 Kifer"
# ---------------------
def parse_messages_manually():
if not os.path.exists(INPUT_FILE):
print(f"Error: Could not find file '{INPUT_FILE}'. Please check the filename.")
return
print(f"Parsing '{INPUT_FILE}' manually to avoid memory errors...")
messages = []
target_name_lower = TARGET_CONTACT_NAME.lower()
in_target_mms = False
try:
with open(INPUT_FILE, 'r', encoding='utf-8', errors='ignore') as f:
for line in f:
stripped_line = line.strip()
# Process SMS: expecting a single line like
if stripped_line.startswith(''):
in_target_mms = False
# Process MMS parts if we are inside a target MMS block
elif in_target_mms and stripped_line.startswith('