b3b6b702d1
- publish_gatekeeper.py (neues Gatekeeper-System) - 4 Premium-Artikel: Veggie Match, Berlin 1960, Wild Tiled West, Scream Park - Alle kumulierten Artikel, Scripts, Medien und Caches
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
import urllib.request, json
|
|
|
|
token = open('/home/hermes/.hermes/joomla_token.txt').read().strip()
|
|
|
|
with open('/home/hermes/workspace/artikel_catan_usa_2026_clean.html') as f:
|
|
full_text = f.read()
|
|
|
|
# Get title from API
|
|
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']
|
|
|
|
# ALLES als fulltext, kein introtext
|
|
payload = {
|
|
'title': title,
|
|
'introtext': '',
|
|
'fulltext': full_text,
|
|
'state': 1
|
|
}
|
|
|
|
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','')
|
|
print(f"HTTP 200 | State={a['state']}")
|
|
print(f"Textlaenge: {len(t)} chars")
|
|
print(f"<style>: {'<style' in t}")
|
|
print(f"bsn-infobox: {'bsn-infobox' in t}")
|
|
except urllib.error.HTTPError as e:
|
|
print(f"HTTP {e.code}: {e.read().decode()[:300]}")
|