import urllib.request, json, re token = open('/home/hermes/.hermes/joomla_token.txt').read().strip() with open('/home/hermes/workspace/artikel_catan_usa_2026_clean.html') as f: text = f.read() parts = text.split('
', 1) intro = parts[0].strip() if len(parts) > 1 else text[:500] full = parts[1].strip() if len(parts) > 1 else '' req = urllib.request.Request( 'https://www.brettspiel-news.de/api/index.php/v1/content/articles/15425', headers={'Accept':'application/vnd.api+json','X-Joomla-Token':token}) r = json.loads(urllib.request.urlopen(req, timeout=10).read()) title = r['data']['attributes']['title'] payload = {'title': title, 'introtext': intro, 'fulltext': full} req2 = urllib.request.Request( 'https://www.brettspiel-news.de/api/index.php/v1/content/articles/15425', data=json.dumps(payload, ensure_ascii=False).encode(), headers={'Accept':'application/vnd.api+json','Content-Type':'application/json','X-Joomla-Token':token}, method='PATCH') try: resp = urllib.request.urlopen(req2, timeout=15) r2 = json.loads(resp.read()) a = r2['data']['attributes'] t = a.get('text','') has_style = ' im Text: {has_style}") print(f"bsn-infobox: {has_bsn}") print(f"Textlaenge: {len(t)} chars") except urllib.error.HTTPError as e: print(f"HTTP {e.code}: {e.read().decode()[:300]}")