ruipgil / scraperjs

A complete and versatile web scraper.
MIT License
3.7k stars 188 forks source link

How can I scrape different websites at the same time? #36

Closed birdgg closed 9 years ago

birdgg commented 9 years ago
for (var option in options) {
  scraperjs.StaticScraper.create()
            .request(option)
            .scrape(function($) {
                return $(site_info.matchElem).map(function() {
                    return {
                        title: $(this).text(),
                        link: $(this).attr('href')
                    }
                }).get();
            }, function(results) {
                results.forEach(function(result) {
                    console.log(result);
                });
            });
}

I want to use this code to scrape several websites,but it only show the last website I scrape.How can I do it?

ruipgil commented 9 years ago

You should use a router.