Files
BSN-Chatsystem/check_excluded.py
Hermes Agent 2a06bcaee0 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
2026-07-09 23:30:55 +02:00

97 lines
3.3 KiB
Python

#!/usr/bin/env python3
"""Check what items are being excluded by the filter."""
import re
import html as html_mod
with open('/home/hermes/workspace/fantasywelt_data/neuheiten.html', 'r') as f:
content = f.read()
neu_section = content.split('Wieder auf Lager')[0]
rest = content.split('Wieder auf Lager')[1] if 'Wieder auf Lager' in content else ''
wieder_section = rest.split('Neue Vorbestellungen')[0] if 'Neue Vorbestellungen' in rest else rest
EXCLUDE_KEYWORDS = [
'puzzle', 'sleeve', 'deck box', 'deckbox', 'boulder', 'portfolio',
'ultimate guard', 'sidewinder', 'omnihive', 'xenoskin',
'card binder', 'deck protector', 'toploader',
'perfect fit', 'inner sleeve', 'outer sleeve', 'matte sleeve',
'sammelalbum', 'playmat tube',
'spielmatte', 'playmat', 'game mat', 'neoprene', 'play mat',
'orderunit',
'upgrade pack', 'upgrade kit', 'insert', 'organizer', 'organiser',
'ausgrabung', 'kristall', 'farblabor',
'dice set', 'wuerfelset', 'wuerfel set', 'dice pack', 'token set',
'miniatures pack', 'playerboard',
'storage box', 'token box', 'token tray', 'bit box',
'feldherr', 'schaumstoff', 'plastic tray',
'deck box', 'deckbox',
'spiel knobelblock', 'knobelblock',
'anatomiepuzzle',
'spotlight deck', 'spotlight-deck',
'gaming tokens', 'gamegenic', 'alcove flip box',
'play mat', 'premium game mat',
'minifiguren', 'blind bag',
'decals set', 'decal set', 'propeller set',
'leather folder',
'global map',
'tarot deck',
'organizer',
'würfel blind box', 'wuerfel blind box',
'deluxe upgrade',
'abdeckung',
'exclusive extras',
]
def is_excluded(name):
name_lower = name.lower().replace('-', ' ').replace(' ', ' ')
for kw in EXCLUDE_KEYWORDS:
if kw in name_lower:
return True
return False
def parse_all_cards(section):
cards = re.split(
r'<div style="display:flex;gap:0\.8rem;padding:1rem 0;'
r'border-bottom:1px solid #eee;align-items:flex-start;">',
section
)
cards = cards[1:]
parsed = []
for card in cards:
name_match = re.search(
r'<a href="(https://www\.fantasywelt\.de/[^"]+)"[^>]*>([^<]+)</a>',
card
)
if not name_match:
continue
name = html_mod.unescape(name_match.group(2).strip())
if 'Kaufen' in name or '\u2192' in name or len(name) < 3:
continue
parsed.append(name)
return parsed
neu_all = parse_all_cards(neu_section)
wieder_all = parse_all_cards(wieder_section)
print("=== EXCLUDED from NEU IM SHOP ===")
for name in neu_all:
if is_excluded(name):
name_lower = name.lower().replace('-', ' ').replace(' ', ' ')
matching = [kw for kw in EXCLUDE_KEYWORDS if kw in name_lower]
print(f" EXCLUDED: {name}")
print(f" matched: {matching}")
print(f"\n=== EXCLUDED from WIEDER AUF LAGER (first 30) ===")
count = 0
for name in wieder_all:
if is_excluded(name):
name_lower = name.lower().replace('-', ' ').replace(' ', ' ')
matching = [kw for kw in EXCLUDE_KEYWORDS if kw in name_lower]
print(f" EXCLUDED: {name}")
print(f" matched: {matching}")
count += 1
if count >= 30:
print(f" ... and more")
break