SuperEvilMegacorp / vainglory-assets

Community provided art, schemas, and other assets that make using the Vainglory API easier
https://developer.vainglorygame.com
MIT License
54 stars 40 forks source link

Bug: Telemetry is a collection of JSON objects, should be an array #325

Closed schneefux closed 6 years ago

schneefux commented 6 years ago

To reproduce:

curl https://cdn.gamelockerapp.com/semc-vainglory/eu/2017/10/26/21/24/fd2b2893-ba93-11e7-b2a6-0a586461017b-telemetry.json

Returns

{
  "time": "2017-10-26T20:58:17+0000",
  "type": "HeroBan",
  "payload": {
    "Hero": "*Hero009*",
    "Team": "1"
  }
}
{

which can't be parsed as JSON because it's not an array.

schneefux commented 6 years ago

apparently there is not one event per line, to hotfix use the following regex:

// add `,` to the beginning of each event
let hotfix = apiresponse.replace(/\{ "time":/g, ', { "time":');
// `, {` -> `{`, wrap in `[]`
hotfix = "[" + hotfix.substring(2, hotfix.length) + "]";
schneefux commented 6 years ago

For new matches, it is fixed. The match in question above and other matches from that day are still broken.

PierreAndreis commented 6 years ago

This should be fixed for new matches. And unless Madglory fix these matches manually, these matches bugged will be gone in 120 days. With that in mind, I will close the issue