Skip to content

ile/blog-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blog-scraper

A generic blog scraper.

Saves data to mongodb.

install

npm install blog-scraper

usage

from the command line

./scrape <url> [db-name]

  • url should be the url to the first post. On that blog page should be a link to the next post.
  • db-name is blog-scraper by default.

as a Nodejs module

var scraper = require('blog-scraper');
scraper.init('db-name', options);

options has these defaults, any of which can be changed by passing an object to scraper.init():

options = {
	title: 'div.contentContainer section.wide-article > article header h1',
	body: 'div.contentContainer section.wide-article > article div.article-body',
	comments: 'section.comment-list > section',
	time: 'div.contentContainer section.wide-article > article time',
	next: '.article-actions .continue-reading .next a'
}

Note: the time extraction expects a datetime attribute at the selector's target element.

About

A generic blog scraper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published