#!/usr/bin/env python3 """Run full analysis on updated calls24 landing page.""" import requests, base64, json, os # Fetch HTML with obscura os.system('obscura fetch --allow-private-network --wait 5 http://localhost:8899 -o /tmp/calls24_v2.html -q 2>/dev/null') html = open('/tmp/calls24_v2.html').read() print(f"HTML: {len(html)} chars") # 1. DOM Analysis print("\n=== DOM ANALYSIS ===") resp_dom = requests.post('http://localhost:8001/design/analyze-dom', json={ "html": html, "full_analysis": False }) dom = resp_dom.json() print(f"Overall DOM Score: {dom.get('overall_score', 'N/A')}/10") # Key analyzers for key, val in dom.get('analyzers', {}).items(): if isinstance(val, dict) and 'score' in val: print(f" {key}: {val['score']}/10") # 2. Pixel Analysis print("\n=== PIXEL ANALYSIS ===") img_b64 = base64.b64encode(open('/home/nik/.hermes/cache/screenshots/browser_screenshot_0b531830c7bf4166b5969c1c7b8c8326.png', 'rb').read()).decode() resp_px = requests.post('http://localhost:8001/design/analyze', json={ "image_base64": img_b64, "full_analysis": False }) pixel = resp_px.json() print(f"Pixel Score: {pixel.get('overall_score', 'N&A')}/10") for key, val in pixel.get('dimensions', {}).items(): if isinstance(val, dict) and 'score' in val: print(f" {key}: {val['score']}/10") # Combined combined = (dom.get('overall_score', 0) + pixel.get('overall_score', 0)) / 2 print(f"\n=== COMBINED: {combined:.1f}/10 ===") # Save full results with open('/tmp/calls24_v2-full.json', 'w') as f: json.dump({"dom": dom, "pixel": pixel}, f, indent=2, ensure_ascii=False) # Print critical issues print("\n=== CRITICAL ISSUES ===") all_issues = [] if dom.get('analyzers', {}).get('wcag_compliance', {}).get('issues'): all_issues.extend([f"[DOM] {i}" for i in dom['analyzers']['wcag_compliance']['issues']]) if pixel.get('issues'): all_issues.extend([f"[Pixel] {i}" for i in pixel['issues']]) for issue in all_issues: if 'FAIL' in issue or 'Критичн' in issue or 'ОТСУТСТВУЕТ' in issue: print(f" {issue}")