Open webdevbrian opened 9 years ago
hmm great question
it looks like the api is still up
http://forecast.weather.gov/MapClick.phplat=41.83&lon=-71.41&site=okx&unit=0&lg=en&FcstType=json
can you give me a test case that fails?
Yeah it's pretty weird, it just started happening out of nowhere for me -- can verify that the json is viewable through a browser, for whatever reason I can't get it to work through node
mind providing node version and a test case please?
Test case is I have a node project that calls it through geocoding a location, from there I pump in the lat and long coords (verified working) -- no idea why the data is coming back null
null error:Error: Error Parsing Response as JSON
v0.10.3
can you give me the params that you are passing to the function that is causing it to fail?
case ".weather":
if (qualifier===""){
bot.chat("Try .forecast followed by a US state, city, or zip to look up.");
}
else{
google_geocoding.geocode(qualifier, function(err, location) {
//console.log('Location: Lat-:'+location.lat+" Long-:"+location.lng);
if (location!==null){
weather.getWeather(location.lat, location.lng, function(err, data){
console.log(data+" error:"+err);
if (data!==null){
var weekForecast="Forecast for "+data.location.areaDescription+": Current: "+data.currentobservation.Temp+"°F "+data.currentobservation.Weather;
for (var i=0; i<7; i++){
var day = data.time.startPeriodName[i].split(' ');
if (day[1]!='Night'){
weekForecast=weekForecast+"; "+data.time.startPeriodName[i]+": ";
}
else{
weekForecast=weekForecast+", ";
}
weekForecast=weekForecast+data.time.tempLabel[i]+": "+data.data.temperature[i]+"°F";
}
weekForecast=weekForecast.replace(/Sunday/g, 'Sun');
weekForecast=weekForecast.replace(/Monday/g, 'Mon');
weekForecast=weekForecast.replace(/Tuesday/g, 'Tues');
weekForecast=weekForecast.replace(/Wednesday/g, 'Wed');
weekForecast=weekForecast.replace(/Thursday/g, 'Thurs');
weekForecast=weekForecast.replace(/Friday/g, 'Fri');
weekForecast=weekForecast.replace(/Saturday/g, 'Sat');
bot.chat(weekForecast);
}
else{
//can't get the weather at all (it's null)
}
});
}
else{
//Can't find weather location
}
});
}
mind logging out what location.lat, location.lng
is so I can reproduce
Location: Lat-:43.9657221 Long-:-121.2196397
Anything?
I just keep getting null data back as a response ... anyone else?