gigobyte / HLTV

The unofficial HLTV Node.js API
MIT License
397 stars 107 forks source link

`getMatchMapStats` method sometimes crashes #209

Closed mateuszchwaszczewski closed 5 years ago

mateuszchwaszczewski commented 5 years ago

Hello. Method getMatchMapStats crashes sometimes. Example id: 21745

gigobyte commented 5 years ago

Fixed in 2.16.3

RichOnPeers commented 5 years ago

Still crashing. Example ID: 93607 https://www.hltv.org/stats/matches/mapstatsid/93607/heroic-vs-avangar

gigobyte commented 5 years ago

@RichOnPeers, it executes successfully for me, are you sure your IP is not blocked from HLTV or that you're not on an old version?

yarn run v1.15.2
$ ts-node src/playground
{
  matchPageID: 2336953,
  map: 'inf',
  date: 1571404800000,
  team1: { id: 8120, name: 'AVANGAR', score: 16 },
  team2: { id: 7175, name: 'Heroic', score: 14 },
  event: { id: 4093, name: 'DreamHack Open Rotterdam 2019' },
  overview: {
    rating: { team1: 1.1, team2: 0.95 },
    firstKills: { team1: 18, team2: 12 },
    clutchesWon: { team1: 2, team2: 0 },
    mostKills: { id: 10994, name: 'stavn', value: 27 },
    mostDamage: { id: 10994, name: 'stavn', value: 92.2 },
    mostAssists: { id: 11942, name: 'buster', value: 8 },
    mostAWPKills: { id: 13776, name: 'Jame', value: 13 },
    mostFirstKills: { id: 13776, name: 'Jame', value: 5 },
    bestRating: { id: 13239, name: 'qikert', value: 1.37 }
  },
  roundHistory: [
    { outcome: 't_win', score: '1-0', ctTeam: 7175, tTeam: 8120 },
    {
      outcome: 'bomb_exploded',
      score: '2-0',
      ctTeam: 7175,
      tTeam: 8120
    },
    { outcome: 't_win', score: '3-0', ctTeam: 7175, tTeam: 8120 },
    { outcome: 't_win', score: '4-0', ctTeam: 7175, tTeam: 8120 },
    { outcome: 'stopwatch', score: '4-1', ctTeam: 7175, tTeam: 8120 },
    { outcome: 'ct_win', score: '4-2', ctTeam: 7175, tTeam: 8120 },
    { outcome: 'ct_win', score: '4-3', ctTeam: 7175, tTeam: 8120 },
    {
      outcome: 'bomb_exploded',
      score: '5-3',
      ctTeam: 7175,
      tTeam: 8120
    },
    { outcome: 'ct_win', score: '5-4', ctTeam: 7175, tTeam: 8120 },
    { outcome: 'ct_win', score: '5-5', ctTeam: 7175, tTeam: 8120 },
    {
      outcome: 'bomb_exploded',
      score: '6-5',
      ctTeam: 7175,
      tTeam: 8120
    },
    {
      outcome: 'bomb_exploded',
      score: '7-5',
      ctTeam: 7175,
      tTeam: 8120
    },
    { outcome: 'ct_win', score: '7-6', ctTeam: 7175, tTeam: 8120 },
    { outcome: 't_win', score: '8-6', ctTeam: 7175, tTeam: 8120 },
    { outcome: 't_win', score: '9-6', ctTeam: 7175, tTeam: 8120 },
    { outcome: 'ct_win', score: '10-6', ctTeam: 8120, tTeam: 7175 },
    { outcome: 'ct_win', score: '11-6', ctTeam: 8120, tTeam: 7175 },
    {
      outcome: 'bomb_defused',
      score: '12-6',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_exploded',
      score: '12-7',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_exploded',
      score: '12-8',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_exploded',
      score: '12-9',
      ctTeam: 8120,
      tTeam: 7175
    },
    { outcome: 't_win', score: '12-10', ctTeam: 8120, tTeam: 7175 },
    {
      outcome: 'bomb_exploded',
      score: '12-11',
      ctTeam: 8120,
      tTeam: 7175
    },
    { outcome: 'ct_win', score: '13-11', ctTeam: 8120, tTeam: 7175 },
    {
      outcome: 'bomb_defused',
      score: '14-11',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_exploded',
      score: '14-12',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_exploded',
      score: '14-13',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_defused',
      score: '15-13',
      ctTeam: 8120,
      tTeam: 7175
    },
    {
      outcome: 'bomb_exploded',
      score: '15-14',
      ctTeam: 8120,
      tTeam: 7175
    },
    { outcome: 'ct_win', score: '16-14', ctTeam: 8120, tTeam: 7175 }
  ],
  playerStats: {
    team1: [
      {
        id: 13239,
        name: 'qikert',
        kills: 26,
        hsKills: 15,
        assists: 5,
        flashAssists: 0,
        deaths: 16,
        KAST: 76.7,
        killDeathsDifference: 10,
        ADR: 86.8,
        firstKillsDifference: 2,
        rating: 1.37,
        killsPerRound: 0.87,
        deathsPerRound: 0.53,
        impact: 1.51
      },
      {
        id: 11942,
        name: 'buster',
        kills: 16,
        hsKills: 10,
        assists: 9,
        flashAssists: 1,
        deaths: 15,
        KAST: 83.3,
        killDeathsDifference: 1,
        ADR: 65.1,
        firstKillsDifference: 2,
        rating: 1.17,
        killsPerRound: 0.53,
        deathsPerRound: 0.5,
        impact: 1.11
      },
      {
        id: 334,
        name: 'AdreN',
        kills: 19,
        hsKills: 6,
        assists: 7,
        flashAssists: 1,
        deaths: 18,
        KAST: 76.7,
        killDeathsDifference: 1,
        ADR: 75.8,
        firstKillsDifference: 2,
        rating: 1.16,
        killsPerRound: 0.63,
        deathsPerRound: 0.6,
        impact: 1.23
      },
      {
        id: 13776,
        name: 'Jame',
        kills: 21,
        hsKills: 9,
        assists: 2,
        flashAssists: 0,
        deaths: 17,
        KAST: 76.7,
        killDeathsDifference: 4,
        ADR: 65.8,
        firstKillsDifference: 2,
        rating: 1.11,
        killsPerRound: 0.7,
        deathsPerRound: 0.57,
        impact: 0.95
      },
      {
        id: 11716,
        name: 'SANJI',
        kills: 11,
        hsKills: 7,
        assists: 1,
        flashAssists: 0,
        deaths: 18,
        KAST: 50,
        killDeathsDifference: -7,
        ADR: 41.8,
        firstKillsDifference: -2,
        rating: 0.68,
        killsPerRound: 0.37,
        deathsPerRound: 0.6,
        impact: 0.72
      }
    ],
    team2: [
      {
        id: 10994,
        name: 'stavn',
        kills: 27,
        hsKills: 8,
        assists: 6,
        flashAssists: 2,
        deaths: 20,
        KAST: 73.3,
        killDeathsDifference: 7,
        ADR: 92.2,
        firstKillsDifference: -1,
        rating: 1.28,
        killsPerRound: 0.9,
        deathsPerRound: 0.67,
        impact: 1.36
      },
      {
        id: 922,
        name: 'Snappi',
        kills: 20,
        hsKills: 13,
        assists: 6,
        flashAssists: 1,
        deaths: 20,
        KAST: 70,
        killDeathsDifference: 0,
        ADR: 76.4,
        firstKillsDifference: 0,
        rating: 1.03,
        killsPerRound: 0.67,
        deathsPerRound: 0.67,
        impact: 1.07
      },
      {
        id: 9896,
        name: 'b0RUP',
        kills: 12,
        hsKills: 6,
        assists: 4,
        flashAssists: 0,
        deaths: 17,
        KAST: 70,
        killDeathsDifference: -5,
        ADR: 60.5,
        firstKillsDifference: -1,
        rating: 0.91,
        killsPerRound: 0.4,
        deathsPerRound: 0.57,
        impact: 0.62
      },
      {
        id: 8611,
        name: 'es3tag',
        kills: 11,
        hsKills: 5,
        assists: 4,
        flashAssists: 2,
        deaths: 18,
        KAST: 73.3,
        killDeathsDifference: -7,
        ADR: 35.4,
        firstKillsDifference: -4,
        rating: 0.78,
        killsPerRound: 0.37,
        deathsPerRound: 0.6,
        impact: 0.66
      },
      {
        id: 7964,
        name: 'cadiaN',
        kills: 12,
        hsKills: 1,
        assists: 8,
        flashAssists: 7,
        deaths: 18,
        KAST: 66.7,
        killDeathsDifference: -6,
        ADR: 50.2,
        firstKillsDifference: 0,
        rating: 0.77,
        killsPerRound: 0.4,
        deathsPerRound: 0.6,
        impact: 0.39
      }
    ]
  },
  performanceOverview: {
    team1: { kills: 93, deaths: 84, assists: 22 },
    team2: { kills: 82, deaths: 93, assists: 16 }
  }
}
Done in 8.16s.
RichOnPeers commented 5 years ago

@gigobyte : I am running the latest version and have no issues with getMatchStats, getMatch, getPlayer but getMatchMapStats stops working every now and then. Even when getMatchMapStats stops working, getPlayer returns results so I don't think that I am IP blocked (?).

Now suddenly getMatchMapStats with ID 93607 works but an hour ago it did not.

gigobyte commented 5 years ago

That match ended yesterday, maybe HLTV messed up the data for the map and then fixed it later, I don't know. It's very hard to reproduce issues like that.

RichOnPeers commented 5 years ago

I fully understand. I experienced similar issues with older matches when getMatchMapStats didn't want to return data for anything (other API entries still worked). Not sure what to make of it.

gigobyte commented 5 years ago

Thanks anyway, if you notice an ID that makes the endpoint crash please make a new issue with the ID and the error :blush:

RichOnPeers commented 5 years ago

Will do! Keep up the great work :)

itlpps commented 8 months ago

Im getting error on this id: 150329 I think because this match has "overtime"