Skip to content

Node.js web scraper with cheerio to get fictional books data including genres, titles, price, stock availability and more. Tested with Jest.

Notifications You must be signed in to change notification settings

suongfiori/nodejs-books-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Books Scraper API

Introduction

The Node.js Books Scraper API allows you to retrieve fictional book data, including genres, titles, prices, stock availability, and more. It provides two main endpoints to access this data.

  • Base URL: https://confused-threads-cod.cyclic.cloud/

Endpoints

1. Get All Genres

  • Endpoint: /books
  • Method: GET
  • Description: This endpoint returns an array of available book genres.

Example

  • Request:

    GET https://confused-threads-cod.cyclic.cloud/books
  • Response:

    [
      "fiction",
      "mystery",
      "romance",
      ...
    ]

2. Get Books by Genre

  • Endpoint: /books/:genre
  • Method: GET
  • Description: This endpoint allows you to retrieve a list of books for a specific genre.

Example

  • Request:

    GET https://confused-threads-cod.cyclic.cloud/books/fiction
  • Response:

    {
      "status": "success",
      "data": [
        {
          "title": "Book Title",
          "author": "Author Name",
          "price": "$19.99",
          "availability": "In stock",
          ...
        },
        ...
      ],
      "metadata": {
        "genre": "fiction",
        "total_items": 20,
        "total_pages": 2
      }
    }

Data Source

The data provided by this API is sourced from Books to Scrape, a fictional book store used for web scraping practice.

Getting Started

To use this API, make HTTP requests to the provided endpoints.