stiekel / aliexpress Goto Github PK
View Code? Open in Web Editor NEWAn AliExpress spider for Node
An AliExpress spider for Node
Hi,
This library is very useful.
Is there a way to know when the product was listed?
Also, it seems that aliexpress is not showing best selling products anymore.
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.
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.