Changes between Version 2 and Version 3 of jsAutoPageScraper

Show
Ignore:
Timestamp:
04/14/08 03:06:16 (5 years ago)
Author:
stomita (IP: 61.245.102.149)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jsAutoPageScraper

    v2 v3  
    1414svn co http://svn.coderepos.org/share/lang/javascript/jsAutoPageScraper/trunk jsAutoPageScraper 
    1515}}} 
     16 
     17== Sample == 
     18{{{ 
     19 var jscr = new JSAutoPageScraper('http://twitter.com/home', { 
     20   nextLink : '//div[@class="pagination"]/a[last()]', 
     21   paragraph : '//*[contains(@class,"hentry")]', 
     22   mapping : { 
     23     link : './/*[@class="meta entry-meta"]/a[contains(@class,"entry-date")]/@href', 
     24     author : './/td[contains(@class,"content")]/strong/a/text()', 
     25     content : function(p) { (p.textContent || p.innerText).replace(/\s+/g, ' '); } 
     26   }  
     27 }); 
     28 
     29 jscr.scrape(5, callback1) 
     30     .skip(5) 
     31     .scrape(10, callback2) 
     32     .wait(); 
     33 
     34 function callback1(records) { ... } 
     35 function callback2(records) { 
     36   ... 
     37   jscr.done(); 
     38 } 
     39 
     40}}}