import sys,re,html t=open(sys.argv[1],encoding='utf-8',errors='replace').read() # posts posts=re.findall(r']*id=[\'"]elComment_(\d+)[\'"].*?',t,re.S) parts=re.split(r']*id=[\'"]elComment_\d+[\'"]',t)[1:] for p in parts: au=re.search(r'data-ipsHover[^>]*>\s*([^<]+)',p) or re.search(r"profile/\d+-([^/]+)/",p) dt=re.search(r"datetime='([^']+)'",p) or re.search(r'datetime="([^"]+)"',p) m=re.search(r'data-role=[\'"]commentContent[\'"].*?>(.*?)\s*(?:|
]+>',' ',body)); body=re.sub(r'\s+',' ',body) print('@@',(au.group(1) if au else '?'),(dt.group(1) if dt else '?')); print(body[:int(sys.argv[2]) if len(sys.argv)>2 else 1500]); for l in links: print(' LINK',l)