Closed k-meeks closed 6 years ago
Sorry only seeing this now! Hit the same issue. Thanks for fix.
Their API server is currently giving me an internal server error. Including to the app itself. I don't know how long this has been going on, since it's been 3 weeks since I ran my code.
It looks like line 120 in index.js is now the problem. They seem to have switched to using the intapi over int.api and are now requiring both a start time (epoch) and the language variable. I've been able to grab the data via url in browser using
It appears the start date just needs to be before your scale measurement, and if there are multiple entries between the date given and now it'll return multiple results.
so I fixed it by adding this line to the conf.toml
lang = "2"
then modifying index.js to get epoch time at midnight of the current day
var d = new Date(); d.setHours(0,0,0,0); var epochtime = d.getTime() / 1000;
and changed the URL at line 120 to be
uri: 'http://intapi.iyunmai.com/api/android/scale/'+scale+'/list.json?code='+code+'&startTime='+epochtime+'&lang='+lang+'&userId='+userId+'&token='+token,
I weight myself in the morning and have the cron job run ~1 hour after I normally weigh myself, so grabbing everything after midnight of the current day works for me.
Which is to say, my changes there work for my use case. You may want to do something different for others (I suppose could even just declare epochtime as 1000000000 or something to grab everything always).
@k-meeks Thanks! That worked perfectly. I'm back in action.
URL change in recent version of app (2.1.8.1 on my device). The old URL construct no longer works that I can see, updating yunmai-new-token.js with my change on line 29 to the new URL construct solves the issue.
Specifically, when running node yunmai-new-token.js with the int.api.yunmai.com/api/android/scale/[0-9]+/list.json URL in the const regex no longer shows any data. A tcpdump on the device shows that it's actually now connecting to http://intapi.iyunmai.com/api/android/scale/[0-9]+/chart-list.json so updated yunmai-new-token.js and re-ran with node and saw expected code, scale, user and token output.