Coder Social home page Coder Social logo

aliexpress's Introduction

Hi there 👋

Github states

aliexpress's People

Contributors

stiekel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aliexpress's Issues

Compile to ES5 before publishing to NPM

Hi there, would it be possible to compile this module to ES5 before the NPM publish? This would resolve lots of problems for me, as I want to use it with meteor, which assumes all NPM packages in ES5 right now.

TypeError: undefined is not an object (evaluating 'window.lib.mtop.config.prefix="acs"')

info: Error: 当前浏览器不支持Promise,请在windows对象上挂载Promise对象可参考(http://gitlab.alibaba-inc.com/mtb/lib-es6polyfill/tree/master)中的解决方案
info:   https://i.alicdn.com/aew-channel-ui/1.0.0/weex/mtop/mtop-2.3.16.js:1
info: TypeError: undefined is not an object (evaluating 'window.lib.mtop.config.prefix="acs"')
info:   https://i.alicdn.com/ae-header/20181022224448/buyer/front/ae-header.js:12

Time out on AWS Lambda

Hello, I am attempting to use this package on an AWS Lambda function, however it keeps timing out without any explanation as to why. I have made some small edits to the package for my own personal taste, but none of these changes stop it from working on my local Windows environment or on a Centos environment on a VPS.

This is my current code:

const aliexpress = require('aliexpress');

exports.handler = (event, context, callback) => {
	aliexpress.scrape('http://bestselling.aliexpress.com/en?spm=2114.11010108.21.4.dkHNPl', (err, $) => {
		if(err) {
			callback(err);
		} else {
			const goods = [];
			$('#bestselling-top10 .item-desc').each((key, lk) => {
				if(lk && lk.attribs && lk.attribs.href) {
					if(!goods[key]) {
						goods[key] = {}
					}
					goods[key].url = lk.attribs.href;
					if(lk.children && lk.children[0] && lk.children[0].data) {
						goods[key].name = lk.children[0].data;
					}
				}
			});
			$('#bestselling-top10 .item-price .price').map((key, lk) => {
				if(lk) {
					if(lk.children && lk.children[0] && lk.children[0].data) {
						goods[key].price = lk.children[0].data;
					}
				}
			});
			const urls = [];
			for(let index in goods) {
				let url = 'https://' + goods[index].url.substring(2).split('?')[0];
				urls.push(url);
			}
			callback(null, urls);
		}
	});
}

// For testing on my Centos environment

/*exports.handler(null, null, (err, result) => {
	if(err) {
		return console.log(err);
	}
	console.log(result);
});*/

Again, this works perfectly on my local Windows environment AND a Centos 7 environment on a VPS. Note that my lambda function does have the phantomjs linux executable and NOT the .exe.

On my lambda function I get this:

{
  "errorMessage": "2017-12-03T15:58:01.171Z b6c11df8-d842-11e7-97c8-0bbe0f0854b3 Task timed out after 10.00 seconds"
}

The max time is set for 10 seconds, but this happens with 20 seconds, etc. Not sure if this is related to this library specifically, or if it is a phantomjs exclusive problem. This is my first time working with either so I decided to report this here first.

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.