es

ecommerce-scraper

ecommerce scraper

Showing:

Popularity

Downloads/wk

3

GitHub Stars

1

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

6

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

ecommerce-scraper

ecommerce scraper

install

npm install ecommerce-scraper

Examples

Lazada Scraper

//lazada.js
//node lazada.js

var engine=require('ecommerce-scraper')

engine.start({
    homepage:'http://lazada.co.id',
    getAllCategorys:function($){
        var catUrls=[]
        $('.sidebarSecond__itemTitle a').each(function(){
            catUrls.push($(this).attr('href'))
        })
        return catUrls
    },
    maxProcess:2,
    getMaxPages:function($){
        //return $('.pages a').last().text();
        return 1
    },
    formatUrl:function(url,page){
        return url+'?page='+page;
    },
    getProductsUrl:function($){
        var productUrls=[]
        $('.product-card').each(function(){
            productUrls.push($(this).attr('href'))
        })
        return productUrls
    },
    fields:{
        title:function($){
            return $('#prod_title').text()
        },
        brand:function($){
            return $('.prod_header_brand_action a').first().text()
        },
        special_price:function($){
            return $('#special_price_box').text()
        }

    },
    onComplated:function(result){
        console.log(result)
    }
});

Tokopedia Scraper

// tokopedia.js
// node tokopedia.js

var engine=require('ecommerce-scraper')

engine.start({
    homepage:'http://tokopedia.com',
    getAllCategorys:function($){
        var catUrls=[]
        $('.allcat a').each(function(){
            catUrls.push($(this).attr('href'))
        })
        return catUrls
    },
    maxProcess:2,
    getMaxPages:function($){
        return 1
    },
    formatUrl:function(url,page){
        return url+'?page='+page;
    },
    getProductsUrl:function($){
        var productUrls=[]
        $('.product').each(function(){
            productUrls.push($(this).find('a').first().attr('href'))
        })
        return productUrls
    },
    fields:{
        title:function($){
            return $('.product-title').text()
        },
        price:function($){
            return $('span[itemprop=price]').first().text()
        },
        category:function($){
            return $('.breadcrumb li').eq(2).text()
        }

    },
    onComplated:function(result){
        console.log(result)
    }
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial