Originally created by: guilhermehott
I've noticed that the value that comes from the Trends.trendsAt isn't the same value that it's on the json response from twitter. The TrendsJSONImpl.init it's setting the trendsAt with the asOf which most of the time are different.
Below a json response showing the different values
"as_of": "2020-08-11T15:46:00Z",
"created_at": "2020-08-11T15:42:13Z",
and the current implementation on TrendsJSONImpl
void init(String jsonStr, boolean storeJSON) throws TwitterException {
try {
JSONObject json;
if (jsonStr.startsWith("[")) {
JSONArray array = new JSONArray(jsonStr);
if (array.length() > 0) {
json = array.getJSONObject(0);
} else {
throw new TwitterException("No trends found on the specified woeid");
}
} else {
json = new JSONObject(jsonStr);
}
this.asOf = ParseUtil.parseTrendsDate(json.getString("as_of"));
this.location = extractLocation(json, storeJSON);
JSONArray array = json.getJSONArray("trends");
this.trendAt = asOf;
this.trends = jsonArrayToTrendArray(array, storeJSON);
} catch (JSONException jsone) {
throw new TwitterException(jsone.getMessage(), jsone);
}
}
I will submit a pull request with the fix.
Cheers.