Skip to content

Commit

Permalink
Update scraper.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SidorenkovIvan committed Apr 3, 2020
1 parent 111b712 commit 31cddd1
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions scraper.js
Expand Up @@ -152,22 +152,6 @@ q.drain = function () {
start();

async function imgToBase64(url) {
/*
fetch(url)
.then(response => response.buffer())
.then(buffer => {
console.log(buffer);
// Encode to base64
let encodedImage = buffer.toString('base64');
//console.log(encodedImage);
return buffer
})
.then(buf => FileType.fromBuffer(buf))
.then(type => {
console.log(type);
});
*/

let response = await fetch(url);
let buf = await response.buffer();
let type = await FileType.fromBuffer(buf);
Expand All @@ -176,11 +160,6 @@ async function imgToBase64(url) {
return prefix + base64;
}

// const u = "https://tea4u.by/image/cache/catalog/goods/S01735/IMG_9115-330x220.jpg";
// imgToBase64(u).then(function (base64) {
// console.log(base64);
// });

function storeImages() {
let db = new sqlite3.Database(DB_NAME);
db.serialize(async () => {
Expand Down Expand Up @@ -212,4 +191,4 @@ function storeImages() {
stmt.finalize();
db.close();
});
}
}

0 comments on commit 31cddd1

Please sign in to comment.