A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
Cannot find module "moment"
-
@uok825 weird. never seen such a thing
can u try changing the $ to zz
in the require and where used.
$ is usually used for jQuery
-
@sdetweil I just rebuild the module without using request.
-
@uok825 ok, but THAT also make no sense…
-
@sdetweil Hi there! Problem solved. New code:
/* Magic Mirror * Module: MMM-LICE * * By Mykle1 * */ const NodeHelper = require('node_helper'); const request = require('request'); const cheerio = require('cheerio'); module.exports = NodeHelper.create({ start: function() { console.log("Starting node_helper for: " + this.name); }, getLICE: function(url) { request({ url: 'https://kur.altin.in/banka', method: 'GET' }, (error, response, body) => { if (!error && response.statusCode == 200) { const $ = cheerio.load(body); var arr = [] var result = $('.fiyat'); result.each((_id,el) => (arr.push(el.children[0]['data']))) var result = $('h2[id=gfiy]'); result.each((_id,el) => (arr.push(el.children[0]['data']))) this.sendSocketNotification('LICE_RESULT', arr); } }); }, socketNotificationReceived: function(notification, payload) { if (notification === 'GET_LICE') { this.getLICE(payload); } } });
But i have an another problem. Turkish characters in the news seem broken. I think there is a utf-8 error but it doesn’t write anything in the logs.
Edit: The news site is broken, it’s not a mistake about us. -
@uok825 maybe u have to pass a header in the request for utf8 formated response, or encoded…