HTML parser/scraper utilities.
Methods
-
<static> extract(ii, cb)
-
Extract HTML information from a URL (http/https/file).
Parameters:
Name Type Description iiObject Input Information Properties
Name Type Argument Description pagestring URL ('http://', 'https://' or 'file://') selectorstring | Array.<string> CSS selector encodingstring <optional>
HTML encoding (default 'utf8') paginatestring <optional>
CSS selector for pagination resultstring <optional>
Result object CSS selectors cbfunction Callback Properties
Name Type Description erError Error datastring | Array.<string> Output data Example
var html = mbot.load('util/html'); html.extract({ page: 'https://news.google.com/news/', selector: ['h2 > a > .titletext'] }, function(er, data) { if (er) console.log('error: ' + er); else console.log('data: ' + data.join('\n')); });