# -*- coding: utf-8 -*-
import re
import zipfile
from pathlib import Path

APK = Path(__file__).resolve().parent.parent / "apks" / "maribank_sg_base.apk"
with zipfile.ZipFile(str(APK)) as zf:
    for name in zf.namelist():
        if not name.endswith((".json", ".jsbundle")):
            continue
        data = zf.read(name)
        if b"currently unavailable" not in data and b"system is currently" not in data:
            continue
        text = data.decode("utf-8", errors="replace")
        for m in re.finditer(r".{0,40}currently unavailable.{0,60}", text):
            print(f"\n[{name}]")
            print(m.group().replace("\n", " ")[:200])
