willuhmjs / gotquestions

gotquestions is a package designed to scrape the gotquestions.org api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gotquestions


gotquestions is a package designed to scrape the gotquestions.org api
const gq = require("/path/to/gotquestions/src/index.js");
(async () => {
  await gq.fetchDataByQuery("Jesus");
  /*
  {
    error: false,
    articleTitle: "How many prophecies did Jesus fulfill? | GotQuestions.org",
    articleBody: "...",
    url: "..."
  }
  */
})();

Documentation

Error Handling

All errors return the following object

{
  error: true,
  errorStack: "..."
}

gq.fetchDataByUrl(url)

await gq.fetchDataByUrl("https://www.gotquestions.org/prophecies-of-Jesus.html");
/*
{
  error: false,
  articleTitle: "How many prophecies did Jesus fulfill? | GotQuestions.org",
  articleBody: "...",
  url: "..."
}
*/

gq.fetchDataByQuery(query, index)

await gq.fetchDataByQuery("Jesus", 0);
/*
{
  error: false,
  articleTitle: "How many prophecies did Jesus fulfill? | GotQuestions.org",
  articleBody: "..."
}
*/

gq.search(query)

await gq.search("Jesus")
/* 
{ 
  error: false,
  queryResults: [
    {
      articleTitle: "How many prophecies did Jesus fulfill? | GotQuestions.org",
      url: "https://www.gotquestions.org/prophecies-of-Jesus.html"
    },
    ...
  ]
}
*/

License

gotquestions is licensed under the MIT License.

About

gotquestions is a package designed to scrape the gotquestions.org api

License:MIT License


Languages

Language:JavaScript 100.0%