integration with Acre

Here is what you do to get a sizzle-powered HTML DOM from Acre:

acre.require("/freebase/libs/sizzle/sizzle");         // this sizzle-powers the Acre HTML parser
var url = "http://blah.com/";                         // the URL of the HTML document you want to parse
var body = acre.urlfetch(url).body;                   // get the HTML document as a string
var document = acre.html.parse(body)                  // parse the HTML document and get a DOM
var links = document.find("#content a");              // look for all links in the DOM using CSS selectors
for each (var link in links) {                        // iterate over all the links
   var href = link.getAttribute("href");              // get the 'href' attribute of the DOM element returned
   ....
}

Click here to start your own Acre app that we'll host you for free!

Powered by Acre - View the source of this app.