Skip to content

rpidanny/nietzsche.js

Repository files navigation

nietzsche.js

gh-actions codecov

A JavaScript package to download quotes from Goodreads.

Install

$ npm install --save @rpidanny/nietzsche.js

Usage

Basic example

import { getAllQuotesByTag } from '@rpidanny/nietzsche.js'

const quoteResponse = await getAllQuotesByTag('psychology')
console.log(quoteResponse)

API Documentation

getQuotesByTag(options?)

Type: object

key default type description
tag None string The name of the tag to search. e.g. psychology, economics
page 1 number The page number to get the quotes from.

Response Type: GetQuotesResponse

getAllQuotesByTag(options?)

Type: object

key default type description
tag None string The name of the tag to search. e.g. psychology, economics
concurrency 10 number The number of parallel requests to goodreads
maxPages 100 number The maximum number of pages to get quotes from

Response Type: Array<Quotes>

getQuotesByPath(options?)

Type: object

key default type description
path None string The relative url path to extract quotes from. e.g. quotes, quotes/tag/economics
page 1 number The page number to get the quotes from.

Response Type: GetQuotesResponse

getAllQuotesByPath(options?)

Type: object

key default type description
path None string The relative url path to extract quotes from. e.g. quotes, quotes/tag/economics
concurrency 10 number The number of parallel requests to goodreads
maxPages 100 number The maximum number of pages to get quotes from

Response Type: Array<Quotes>

Types

Quote

{
  text: string
  author: string
  likes: number
  tags: Array<string>
}

GetQuotesResponse

{
  quotes: Array<Quote>
  pageNumber: number
  totalPages: number
  count: number
}