hidabroot v0.8.1-beta
Hidabroot API (unofficial)
An (unofficial) API for Hidabroot
Important notice
This API is unofficial, meaning I am not responisble for any damage caused by using this API. This API may be blocked at any time by Hidabroot's team. This API is never stable as Hidabroot can change at any time their website structure that will break this API.
Install
npm install hidabroot
Or with yarn:
yarn add hidabroot
Usage
import { todayNews } from "hidabroot";
todayNews().then((news) => {
console.log(news);
});
//=> JSON object containing news titles along with their IDs
(also compitable with commonjs)
API
todayNews()
Example
const { todayNews } = require("hidabroot");
todayNews().then((result) => {
console.log(result);
});
Will return something like this:
{
"big article block title is here": 123456, //the number is the article ID. can be used with getArticle()
"first small article block title is here": 123456,
"second small article block title is here": 123456,
"third small article block title is here": 123456,
"fourth small article block title is here": 123456
}
getArticle(id)
id
Type: number
The ID of the article. The ID can be found in the URL: https://www.hidabroot.org/article/X
(X is the ID).
Example
const { getArticle } = require("hidabroot");
getArticle(1185334).then((result) => console.log(result));
//gets the content of the article: https://www.hidabroot.org/article/1185334 and then log the content to the console
search(query, options?)
query
Type: string
The query to search for in the website.
options
Type: searchOptions
The options for the search. Recommended to get better results.
Example
import { search } from "hidabroot";
const response = await search("האם היו עולמות קודמים?", {
searchOptions: { searchType: "faq" }, // "faq" means "Ask The Rabbi" questions
});
console.log(response);
Which return to the console something like this:
{
"url for result": "result title"
}
Currently (v0.8.0
), the search is capable to return ~10-15 results. This may be changed in the future.
askTheRabbi(questionID)
questionID
Type: number
The "Ask The Rabbi" question ID. Can be found in https://www.hidabroot.org/question/X
where X is the question ID.
Example
import { askTheRabbi, idExtracter } from "hidabroot";
const questionID = idExtracter("https://www.hidabroot.org/question/75137", {
pageType: "askTheRabbi",
});
const response = await askTheRabbi(questionID);
console.log(response);
Which return to the console something like this:
{
"title": "the question title",
"question": "the question",
"answer": "the rabbi answer"
}
(or null
if the page wasn't found or if an error occurred)
idExtracter(input, options)
input
Type: string
The input URL of the Hidabroot page to extract the ID from.
options
Type: idExtracterOptions
The options for the extract process.
Example
import { idExtracter } from "hidabroot";
const questionID = idExtracter("https://www.hidabroot.org/question/75137", {
pageType: "askTheRabbi",
});
console.log(questionID);
//=> 75137
Contributing
All contributions are welcome! Feel free to open an issue (just search the issue tracker before opening an issue to make sure your issue hasn't already been reported or answered) or a pull request.
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago