Read the statement by Michael Teeuw here.
MMM-EveryNews is not loading anything
-
@JeanMichelC yeh, no error is reported… do this
edit the node_helper.js and
change this}, (error, response, body) => { if (!error && response.statusCode == 200) { var result = JSON.parse(body).articles; this.sendSocketNotification('NATGEO_RESULT', result); } });
to this
}, (error, response, body) => { if (!error) { if(response.statusCode == 200) { var result = JSON.parse(body).articles; this.sendSocketNotification('NATGEO_RESULT', result); } else { console.error(this.name+" status failed=",response.statusCode) } } else { console.error(this.name+" error=",error) } });
with a bad api key I see on the console now
[11.01.2023 12:45.23.391] [ERROR] MMM-EveryNews status failed= 401
using the config provided in the module readme
-
I edtited node_helper.js in this folder MagicMirror/js and could not find the code you asked me to change. The only reference I found that checking the response return code 200 is
NodeHelper.checkFetchStatus = function (response) {
// response.status >= 200 && response.status < 300
if (response.ok) {
return response;
} else {
throw Error(response.statusText);
}
}; -
I was looking in the wrong folder, I found it in the MMM-EveryNews folder, making changes now
-
@sdetweil said in MMM-EveryNews is not loading anything:
if (!error) { if(response.statusCode == 200) { var result = JSON.parse(body).articles; this.sendSocketNotification('NATGEO_RESULT', result); } else { console.error(this.name+" status failed=",response.statusCode) } } else { console.error(this.name+" error=",error) }
I get a Bad Request 400 response code, any idea?
This is the entry in the config.js file
{
disabled: false,
module: ‘MMM-EveryNews’,
position: ‘top right’,
config: {
source: “msnbc”, // any source from https://newsapi.org/sources. // Up to 10 at once
scroll: true, // description scroll or static
scrollSpeed: “3”, // if scroll is true
apiKey: “xxxxxxxxxxxxxxxxxxxxxxxx”, // free API key from https://newsapi.org/register
useHeader: true, // False if you don’t want a header
header: “Over 30,000 News Sources!”, // Any text you want. useHeader must be true
maxWidth: “350px”,
animationSpeed: 3000, // fade speed
rotateInterval: 5 * 60 * 1000,
}
},I tested the API key on NewsAPI site and it worked fine
-
@JeanMichelC no… my guess is that the api has changed and the module has not been updated.
the author is currently not available.but, see the comments in issue 5
-
Thanks Sam for pointing me to issue#6, I applied the changed and now it’s working! I really appreciate your help.