import re, json, subprocess, html
from concurrent.futures import ThreadPoolExecutor
G='sci.crypt'
threads=json.load(open('threads.json'))
def get(u): return subprocess.run(['curl','-s','-m','60','-A','Mozilla/5.0',u],capture_output=True,text=True).stdout
def work(t):
h=get(f'https://groups.google.com/g/{G}/c/{t}'); out=[]
for sec in re.split(r'(?=([^<]+)',sec); mid=re.search(r'data-message-id="([^"]+)"',sec) or re.search(r'data-doc-id="([^"]+)"',sec)
body=re.search(r']*>(.*?)
',sec,re.S)
out.append(dict(thread=t,msg=mid.group(1) if mid else None,author=html.unescape(au.group(1)),date_disp=dt.group(1) if dt else None,
subject=html.unescape((re.search(r'data-subject="([^"]*)"',sec) or [None,''])[1]),body_html=body.group(1) if body else None,
url=f'https://groups.google.com/g/{G}/c/{t}/m/{mid.group(1) if mid else ""}', n_sections=h.count('