Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
from pathlib import Path, PurePosixPath
import re
data = Path('MasterPlayerFileGradeLevel.ppl').read_bytes()
regex = re.compile(rb'[A-Za-z][A-Za-z0-9_\-\.]{2,}')
found = [(m.start(), m.group().decode('ascii', errors='ignore')) for m in regex.finditer(data)]
# unique and nexts
entries = []
for i,(pos,s) in enumerate(found):
if i==0 or pos - found[i-1][0] > 32:
entries.append((pos,s))
with open('string_extracts.txt','w',encoding='utf-8') as f:
f.write(f'Found {len(found)} matches, {len(entries)} segment starts\n')
for pos,s in entries[:500]:
f.write(f'{pos:08x} {s}\n')
print('Wrote string_extracts.txt with first 500 segments')