GithubHelp home page GithubHelp logo

tarsbase / goodreads-quote-scraper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from endamolloy/goodreads-quote-scraper

0.0 1.0 0.0 38 KB

Nightmarejs based web scraper that writes quotes from a chosen author to json file

JavaScript 100.00%

goodreads-quote-scraper's Introduction

goodreads-quote-scraper

A nightmarejs based webscraper for collecting quotes of a given author from goodreads.com. The quotes are then saved as a prettified json file in your root directory.

The quotes are ordered as on goodreads i.e. most liked first. Only quotes attributed to the author are written to the final file.

Installation

npm install --save goodreads-quote-scraper

Note: electron can take some time to download.

NPM

Usage

The API takes three arguments, the third being optional.

  1. [string] - The author who's quotes you wish to scrape
  2. [Number] - The number of pages you wish to scrape (Goodreads has 20 quotes per page).
  3. [Boolean] - Whether or not you want the electron instance to show. Default is false.
//index.js

const goodreads = require('goodreads-quote-scraper');

goodreads('george bernard shaw', 2, true);

To batch quote scraping from a number of authors

getQuotes();

async function getQuotes(){
  try{
    await goodreads('ralph waldo emerson', 2);
    await goodreads('mark twain', 5);
    await goodreads('harper lee', 1);
  }
  catch(err){
    console.log(err);
  }
}

Output

A message is logged to the console when the file has been written

george bernard shaw is complete!
├── node_modules
├── index.js
├── george-bernard-shaw.json
//george-bernard-shaw.json

[
    {
        "quote": "Life isn't about finding yourself. Life is about creating yourself.",
        "author": "George Bernard Shaw"
    },
    {
        "quote": "Make it a rule never to give a child a book you would not read yourself.",
        "author": "George Bernard Shaw"
    },
    ...

goodreads-quote-scraper's People

Contributors

endamolloy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.