Skip to content

Instantly share code, notes, and snippets.

@eagl3s1ght
Created October 16, 2017 17:45
Show Gist options
  • Save eagl3s1ght/63a3cc3c89b40b2e6ff0dec451e8e0fc to your computer and use it in GitHub Desktop.
Save eagl3s1ght/63a3cc3c89b40b2e6ff0dec451e8e0fc to your computer and use it in GitHub Desktop.
const rp = require("request-promise").defaults({ encoding: "utf8" });
const cheerio = require("cheerio");
const _ = require("underscore");
var he = require("he");
var parseXlsx = require("excel");
const FilePath =
"test.csv";
parseXlsx(FilePath, function(err, data) {
for (row in data) {
let i = 0;
let col_1 = data[row][0];
getSearch(col_1);
}
});
function getSearch(artnr) {
const options = {
uri: `http://www.google.com/`,
transform: function(body) {
return cheerio.load(body);
}
};
rp(options)
.then($ => {
getResult();
})
.catch(err => {
console.log(err);
});
}
function getResult() {
const options = {
uri: `http://www.example.com/`,
transform: function(body) {
return cheerio.load(body);
}
};
rp(options)
.then($ => {
console.log("done")
})
.catch(err => {
console.log(err);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment