Giter Club home page Giter Club logo

ecommerce-scraper's Introduction

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)
	}
});

ecommerce-scraper's People

Contributors

lukluk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.