Closed camende closed 4 years ago
It seems that changes have been made to both the VF and MT site, which causes the script to load the incorrect information. The VT script tries to convert the text "x minutes ago" to a date, which obviously won't work.
I have identified the red squared boxes is what the script currently loads... and tries to convert to a date.
What would be needed is the blue squared information
This concerns below lines in the java script, but I am unfortunately not experienced enough in Java and webscraping to convert these to pull the correct information....
const timestamp = new Date($('.vfix-top:nth-of-type(1) .tparams tr:nth-of-type(11) .v3').text()).toString(); const unixtime = new Date($('.vfix-top:nth-of-type(1) .tparams tr:nth-of-type(11) .v3').text()).getTime()/1000;
Nice! ais-api
uses cheerio
, which in turn uses css-select
for these selectors. css-select
just implements CSS3 selectors. So this should be straightforward ...
Dears,
We are running the API on a google cloud instance, and we're able to call it without any problems. Suddenly this afternoon the returns started to come with an "Invalid Date"
{ "error": null, "data": { "timestamp": "Invalid Date", "unixtime": null, "latitude": 39.86164, "longitude": -0.06943, "course": 88, "speed": 0 } } Is there anything wrong with our settings?