13 lines
790 B
Python
13 lines
790 B
Python
# -*- coding: utf-8 -*-
|
|
"""Titel-, Description- und H2-Begriffe gegen den Brief. Aufruf: python3 build/meta_luecken.py SLUG"""
|
|
import json, re, sys
|
|
s = sys.argv[1]
|
|
a = json.load(open(f'artikel/artikel-{s}.json', encoding='utf-8'))
|
|
z = json.load(open(f'build/lokal/briefe/{s}.json', encoding='utf-8'))['zusatz']
|
|
h2 = ' '.join(re.findall(r'<h2>(.*?)</h2>', a['content_html'])) + ' ' + a.get('faq_ueberschrift', '')
|
|
for name, text, liste in [('Titel', a['seo_titel'], z.get('begriffe_titel', [])),
|
|
('Description', a['seo_beschreibung'], z.get('begriffe_description', [])),
|
|
('H2', h2, z.get('begriffe_h2', []))]:
|
|
fehlt = [b for b in liste if b.lower() not in text.lower()]
|
|
print(f'{name}: {text[:160]}\n fehlt: {", ".join(fehlt)}')
|