fictionpress-scraper: A web scraper for capturing stories

fictionpress-scraper is a web scraper written in Node.js. It makes use of promises which enable asynchronous computations in Node’s event loop. When passed a Fictionpress story ID, this library will verify that the story exists, and then fetches all the chapters for that story along with some metadata. At this stage, it will provide the story title, author’s name, summary of the story and all chapters (with chapter titles, if available).

This library makes use of the following useful libraries:

  • cheerio (trawls HTML pages for metadata)
  • request (makes & receives HTTP(S) calls)
  • bluebird (provides promises functionality)

Installation

npm install fictionpress-scraper --save

Usage

var fpScraper = require('fictionpress-scraper');

fpScraper.getStory(storyId)

Fetches information, along with all chapters of the story.

fpScraper.getStory(storyID).then(function(story){
 console.log(story);
}).catch(function(error){
 console.log(error);
});

The following properties are available on the returned story object:

{
 "id": Number,
 "title": String,
 "author": {
  "id": Number,
  "name": String
 },
 "summary": String,
 "noOfChapters": Number,
 "content": []
}

story.content is an array filled with chapter objects with the following structure:

{
 "id": Number,
 "title": String,
 "data": String
}

License

fictionpress-scraper is released under the MIT License. See LICENSE.md

Fork me on GitHub