Collection of useful extraction functions
Example
var Fn = require('html-scrapper').Fn;
var schema = {
items: [{
$rule: 'ul#items li'
name:{
$rule: 'a.title',
$fn: Fn.text
},
price:{
$rule: 'b.price',
$fn: Fn.asInt
},
}],
};
Methods
(static) asFloat()
get text content and cast it into Float using parseFloat. All coma are deleted in the string.
(static) asInt()
get text content and cast it into integer using parseInt. All coma are deleted in the string. Useful for parsing Pricing texts
(static) classes()
get value of 'class' attribute
(static) data()
get value of JQuery(elem).data().
(static) link()
get value of 'href' attribute
(static) src()
get value of 'src' attribute
(static) text()
get text content