fix: <style>-Blöcke aus allen 24 Artikeln entfernt + Skill korrigiert
- artikel_*.html: 24 Dateien von <style>-Blöcken befreit (body, max-width zerstören Joomla) - journalistic-article-writing SKILL.md: falsche 'AUSNAHME 09.07.' entfernt - Ursache: Skill-Kommentar erlaubte Sub-Agenten <style> 'für Vorschau' — kein Gatekeeper existiert
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Scrape BGA news for new game releases since ID 1103."""
|
||||
import subprocess
|
||||
import re
|
||||
import time
|
||||
import json
|
||||
|
||||
AGENT_BROWSER = "/home/hermes/.hermes/node/lib/node_modules/agent-browser/bin/agent-browser-linux-x64"
|
||||
|
||||
def run(cmd, timeout=15):
|
||||
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
|
||||
return result.stdout + result.stderr
|
||||
|
||||
results = []
|
||||
for news_id in range(1104, 1121):
|
||||
# Close any existing session
|
||||
run(f'{AGENT_BROWSER} close --all 2>/dev/null', timeout=3)
|
||||
|
||||
print(f"Checking ID {news_id}...", flush=True)
|
||||
open_out = run(f'{AGENT_BROWSER} open "https://en.boardgamearena.com/news?id={news_id}" --args "--no-sandbox"', timeout=20)
|
||||
time.sleep(2)
|
||||
|
||||
snap = run(f'{AGENT_BROWSER} snapshot', timeout=15)
|
||||
|
||||
# Quick filter: empty pages are very short
|
||||
if len(snap) < 2000:
|
||||
print(f" ID {news_id}: SKIP (snapshot length {len(snap)} — no content)", flush=True)
|
||||
continue
|
||||
|
||||
# Extract heading (level 3 = game title)
|
||||
heading_match = re.findall(r'heading\s+"([^"]+)"\s+\[level=3\]', snap)
|
||||
# Extract date: "Month DDth YYYY" format
|
||||
date_match = re.findall(r'StaticText\s+"(\w+\s+\d+(?:th|st|nd|rd)\s+\d{4})"', snap)
|
||||
|
||||
title = heading_match[0] if heading_match else None
|
||||
date = date_match[-1] if date_match else None
|
||||
|
||||
# Also extract gamepanel links
|
||||
gamepanel_links = re.findall(r'link\s+"(https://boardgamearena\.com/gamepanel\?game=[^"]+)"', snap)
|
||||
|
||||
print(f" ID {news_id}: title={title}, date={date}, panels={gamepanel_links}", flush=True)
|
||||
|
||||
if title:
|
||||
results.append({
|
||||
"id": news_id,
|
||||
"date": date,
|
||||
"title": title,
|
||||
"gamepanel_links": gamepanel_links
|
||||
})
|
||||
|
||||
# Close session
|
||||
run(f'{AGENT_BROWSER} close --all 2>/dev/null', timeout=3)
|
||||
|
||||
print("\n=== RESULTS ===")
|
||||
print(json.dumps(results, indent=2, ensure_ascii=False))
|
||||
Reference in New Issue
Block a user