SDK to access ketabonline.com APIs.
To install ketab-online-sdk, use npm or yarn:
npm install ketab-online-sdk
# or
yarn add ketab-online-sdk
# or
pnpm i ketab-online-sdk
import { getBookInfo, getBookContents, downloadBook } from 'ketab-online-sdk';
Retrieve metadata about a specific book.
(async () => {
try {
const bookInfo = await getBookInfo(123);
console.log(bookInfo);
} catch (error) {
console.error(error.message);
}
})();
Fetch information about an author.
(async () => {
try {
const authorInfo = await getAuthorInfo(123);
console.log(authorInfo);
} catch (error) {
console.error(error.message);
}
})();
Fetch information about a category.
(async () => {
try {
const categoryInfo = await getCategoryInfo(123);
console.log(categoryInfo);
} catch (error) {
console.error(error.message);
}
})();
Fetch the contents of a book, including chapters and sections.
(async () => {
try {
const bookContents = await getBookContents(123);
console.log(bookContents);
} catch (error) {
console.error(error.message);
}
})();
Download a book's data to a local file.
(async () => {
try {
const outputFilePath = await downloadBook(123, './book.json');
console.log(`Book downloaded to ${outputFilePath}`);
} catch (error) {
console.error(error.message);
}
})();