An octopus that can get his hands all over the web.
JavaScript
Switch branches/tags
Nothing to show
Latest commit 7ff55f1 Jun 21, 2016 @aularon committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
doc Initial Commit Feb 10, 2013
examples Initial Commit Feb 10, 2013
lib block level elements \n for tools.getText Oct 4, 2013
.gitignore Initial Commit Feb 10, 2013
README.md Update README.md Jun 21, 2016
index.js tools expose Sep 28, 2013
package.json version up Oct 4, 2013

README.md

node-octopus

Elephant Logo

An octopus that can get his hands all over the web.

From Syria with Love : )

This package is a product of Syria, 2013.

Installation

npm install https://github.com/aularon/node-octopus

Usage & Examples

var octopus = require('octopus'),
    $ = octopus.$,
    htmlparser = require('htmlparser2');
var getText = function getText(elem){//from `domutils' package
    if(htmlparser.DomUtils.isTag(elem)) return elem.children.map(getText).join("");
    if(elem.type === htmlparser.ElementType.Text) return elem.data;
    return "";
};

var wikiOctopus = new octopus.Octopus();

wikiOctopus.addURL('https://en.wikipedia.org/wiki/Main_Page');
wikiOctopus.handle(/^/, function(href, dom) {
    $(dom, '#mp-itn li').forEach(function(elem) {
        console.log('', getText(elem), $(elem, 'a')[0].attribs.href)
    })
})

wikiOctopus.start();

Roadmap

  • Documenting current features and usage.

Copyright & License

© 2013 Hasan Arous. All rights reserved.

Mozilla Public License Version 2.0