start.js 721 B

123456789101112131415161718192021
  1. let answer = [];
  2. fetch('https://searx.space/data/instances.json')
  3. .then(response => response.json())
  4. .then(response => {
  5. searx_data = response.instances;
  6. for (var key in searx_data)
  7. if (searx_data[key]['http']['grade']=='A+')
  8. if ('tls' in searx_data[key])
  9. if (searx_data[key]['tls']['grade']=='A+')
  10. if ('html' in searx_data[key]) {
  11. temp = searx_data[key]['html']['grade'];
  12. if (temp=='V' || temp=='C')
  13. answer.push(key);
  14. }
  15. const randomInstance = answer[Math.floor(Math.random() * answer.length)];
  16. // to see selected instance
  17. // console.log(randomInstance)
  18. })