searx-api

1.0.5 • Public • Published

Installation

npm i searx-api

Examples

Can be found in folder examples

Simple usage (callback style)

const Searxuser = require('searx-api');

const searx = new Searxuser(
  'https://searx.kaikkitietokoneista.net//', //Url
  'https', //Protocol
  'en-US', //Language
  '1' //Safe search
)

searx.find("kaikkitietokoneista", function(err, data) {
  if (err === "rate_limited") {
    console.log("Cannot proceed. Searx server ratelimit has been exceeded.")
  } else {
    console.log("Searching for: " + data.query + "\n\n");

    data.results.forEach((item) => {
      console.log("TITLE: " + item.title + "\n\t URL: " + item.url);
    });  
  }
});

Async usage

const Searxuser = require('searx-api');

const searx = new Searxuser(
  'https://searx.kaikkitietokoneista.net//', //Url
  'https', //Protocol
  'en-US', //Language
  '1' //Safe search
)

try {
  const results = await searx.a_find("kaikkitietokoneista")
  results.forEach((item) => {
    console.log("TITLE: " + item.title + "\n\t URL: " + item.url);
  });
} catch(e) {
  // error occured while searching
  console.log("ERROR WHILE SEARCHING: ", e)
}

Package Sidebar

Install

npm i searx-api

Weekly Downloads

8

Version

1.0.5

License

SEE LICENSE IN LICENSE

Unpacked Size

8.01 kB

Total Files

10

Last publish

Collaborators

  • kaikkitietokoneista