import urllib.request, ssl, json, urllib.parse, socket ctx = ssl.create_default_context() def get(url, headers=None, timeout=10): h = headers or {'user-agent': 'Mozilla/5.0 (compatible; deepseek-harness/0.0.1)'} req = urllib.request.Request(url, headers=h) with urllib.request.urlopen(req, timeout=timeout, context=ctx) as r: return r.status, r.read().decode('utf-8', 'replace') # Independent recent instance lists lists = [ 'https://searx.space/data/instances.json', 'https://raw.githubusercontent.com/searxng/searx-instances/master/instances.json', ] seen = {} for src in lists: try: st, body = get(src) data = json.loads(body) inst = data.get('instances', data) if isinstance(data, dict) else {} if isinstance(inst, dict): for host, meta in inst.items(): if isinstance(meta, dict): urlv = meta.get('url') or (f'https://{host}' if not host.startswith('http') else host) jf = meta.get('json', False) seen.setdefault(urlv.rstrip('/'), {'json': jf, 'meta': meta}) print(f'[{src}] status={st} counted={len(seen)}') except Exception as e: print(f'[{src}] FAIL {type(e).__name__}: {e}') print('total candidates:', len(seen)) q = urllib.parse.quote('погода Норильск') found = [] # Probe json-capable first, then all https ones briefly pref = [u for u, m in seen.items() if m.get('json')] rest = [u for u, m in seen.items() if not m.get('json')] for u in pref + rest: if not u.startswith('http'): continue base = u.rstrip('/') url = f'{base}/search?q={q}&format=json' try: st, body = get(url, {'accept': 'application/json', 'user-agent': 'deepseek-harness/0.0.1'}, timeout=8) if '"results"' in body and ('"url"' in body or 'results' in body): found.append((base, st, body[:600])) print(f'!!! CANDIDATE {base} HTTP {st}') print(body[:600]) break except Exception as e: pass if not found: print('NO working json instance among', len(seen), 'candidates')