Retro-Artikel #46-#57: BSN-Standard-Fixes + Abkürzungs-Check (Daniel 24.06.2026)

This commit is contained in:
Hermes Agent
2026-06-24 23:07:48 +02:00
parent 8902915f03
commit 0a63f0439f
68 changed files with 128219 additions and 5973 deletions
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
"""Quick check: are the buy-box shop links still valid?"""
import re, urllib.request, sys, os
WORKSPACE = '/home/hermes/workspace'
def check_url(url, timeout=8):
try:
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
resp = urllib.request.urlopen(req, timeout=timeout)
body = resp.read().decode('utf-8', errors='ignore')[:5000]
status = resp.getcode()
# Quick heuristics for availability
unavailable_patterns = [
'nicht lieferbar', 'ausverkauft', 'out of stock', 'derzeit nicht verfügbar',
'currently unavailable', 'vergriffen', 'nicht auf lager',
'leider ausverkauft', 'nicht mehr verfügbar'
]
body_lower = body.lower()
for pat in unavailable_patterns:
if pat in body_lower:
return f"{pat}"
if status == 404:
return "❌ 404"
if status == 200:
return "✅ available"
return f"⚠️ status={status}"
except Exception as e:
return f"{type(e).__name__}"
def main():
retro_files = sorted([
f for f in os.listdir(WORKSPACE)
if (('retro_2026-06-15' in f or 'sky_team_2026' in f or 'deep_regrets_2026' in f)
and f.endswith('.html'))
])
for fname in retro_files[:3]: # Just sample first 3
filepath = os.path.join(WORKSPACE, fname)
with open(filepath) as f:
content = f.read()
# Extract buy box links
buy_start = content.find('affiliate-box')
if buy_start < 0:
buy_start = content.find('buy-box')
if buy_start < 0:
print(f"\n{fname}: NO BUY BOX")
continue
# Extract links from buy box section
buy_section = content[buy_start:buy_start+2000]
links = re.findall(r'href="(https?://[^"]*)"', buy_section)
print(f"\n{fname} ({len(links)} links):")
for link in links:
# Extract shop name from URL
shop = re.search(r'https?://(?:www\.)?([^/]+)', link)
shop_name = shop.group(1) if shop else link[:50]
result = check_url(link)
print(f" {shop_name}: {result}")
if __name__ == '__main__':
main()