37 lines
1.6 KiB
Python
Executable file
37 lines
1.6 KiB
Python
Executable file
import json, requests, time
|
|
|
|
with open('/workspace/ecommerce_research_sources/benchmark_master_v2.json', 'r', encoding='utf-8') as f:
|
|
master = json.load(f)
|
|
|
|
urls_to_check = []
|
|
for e in master.get('executives_directory', []):
|
|
for inv in e.get('key_interviews', []):
|
|
urls_to_check.append(('exec', e['name'], inv['title'], inv['url']))
|
|
|
|
for p in master.get('failures_and_pivots_dossier', []):
|
|
urls_to_check.append(('postmortem', p['id'], p['title'], p['verified_source_url']))
|
|
|
|
for l in master.get('growth_levers_data', []):
|
|
urls_to_check.append(('lever', l['name'], l['source_title'], l['source_url']))
|
|
|
|
for c in master.get('commissions_data', []):
|
|
urls_to_check.append(('commission', c['category_fa'], 'Commission Rule', c['source_url']))
|
|
|
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'}
|
|
|
|
results = []
|
|
print(f"Starting fact check of {len(urls_to_check)} URLs...")
|
|
|
|
for kind, entity, title, url in urls_to_check:
|
|
try:
|
|
r = requests.get(url, headers=headers, timeout=6, allow_redirects=True)
|
|
status = r.status_code
|
|
ok = (status == 200)
|
|
results.append({'kind': kind, 'entity': entity, 'title': title, 'url': url, 'status': status, 'ok': ok})
|
|
print(f"[{status}] {url} ({entity})")
|
|
except Exception as ex:
|
|
results.append({'kind': kind, 'entity': entity, 'title': title, 'url': url, 'status': str(ex)[:40], 'ok': False})
|
|
print(f"[ERR] {url} -> {str(ex)[:40]}")
|
|
|
|
ok_count = sum(1 for r in results if r['ok'])
|
|
print(f"\nSummary: {ok_count} / {len(results)} URLs returned HTTP 200.")
|