UNPKG

website-to-json

Version:

Converts all websites to JSON data

21 lines (16 loc) 424 B
var wtj = require('./index') //var wtj = require('website-to-json') wtj.extractUrl('http://stackoverflow.com/questions/3207418/crawler-vs-scraper', { fields: ['data'], parse: function($) { return { title: $("h1").text(), keywords: $('.post-taglist a').map(function(val) { return $(this).text() }).get() } } }) .then(function(res) { console.log(JSON.stringify(res, null, 2)); })