Created
October 16, 2017 17:45
-
-
Save eagl3s1ght/63a3cc3c89b40b2e6ff0dec451e8e0fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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