I recently try to use node js to collect some data from other web like yahoo finance, one of urls like this "http://real-chart.finance.yahoo.com/table.csv?s=AAPL&a=11&b=12&c=1999&d=01&e=4&f=2016&g=d&ignore=.csv", if i put this url into a browser, a popup will be prompted. while in my node code this url will not be found.
var fs = require('fs');
var http = require('http');
var url = require('url');
var csv = require( "fast-csv" );
// var FILENAME = "file/table.csv";
var FILENAME = "http://real-chart.finance.yahoo.com/table.csv?s=AAPL&a=11&b=12&c=1999&d=01&e=4&f=2016&g=d&ignore=.csv";
function fast_csv_read(filename)
{
csv.fromPath(filename)
.on("data", function(data){
console.log("current data: ");
console.log(data);
})
.on("end", function(){
console.log("done reading");
});
}
fast_csv_read(FILENAME);
if I download this file with browser and save it in "file/table.csv", it works fine. no idea what is going wrong...