Answer the question
In order to leave comments, you need to log in
Why can't I download a picture from discogs.com?
For some reason I can't download the file from diskogs. The request arrives, there are no errors, but an incorrect file is created.
For any other link, everything is ok, but does not want to from discogs. Do they have some kind of tricky link? Blocking? Nobody faced?
var https = require('https');
var fs = require('fs');
var link1 = "https://i.pinimg.com/564x/df/a0/5c/dfa05ce90cbcbc47c8837e9172948dfc.jpg";
var link2 = "https://img.discogs.com/swlUq29dib4kEyctdxO38RDwDrc=/fit-in/600x594/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-1111653-1477834177-2042.jpeg.jpg";
var file1 = fs.createWriteStream("file1.jpg");
var request1 = https.get(link1, function(response) {
response.pipe(file1);
response.on('error', function(error) {
console.log('error ', error)
});
response.on('end', function(error) {
console.log('request1 end ')
});
});
var file2 = fs.createWriteStream("file2.jpg");
var request2 = https.get(link2, function(response) {
response.pipe(file2);
response.on('error', function(error) {
console.log('error ', error)
});
response.on('end', function(error) {
console.log('request2 end ')
});
});
file1.on('error', function(err) {
console.log('file1 err', err);
});
file1.on('finish', function() {
console.log('file1 finish',);
});
file2.on('error', function(err) {
console.log('file2 err', err);
});
file2.on('finish', function() {
console.log('file2 finish',);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question