CraftySalamander / RTS_Overlay

Overlay for RTS, with build orders, match data...
GNU General Public License v3.0
68 stars 5 forks source link

Problems when fetching to aoe2.net #9

Closed Ponpok0 closed 1 year ago

Ponpok0 commented 1 year ago

I have been unable to retrieve match information from aoe2.net for several days. exception message "Some issue occurred while trying to get the match data." is displayed.

Plus, when I access the aoe2.net api in chrome the web browser, I get the correct information. https://aoe2.net/#api

Ponpok0 commented 1 year ago

I was able to get the information before this, so I am not sure, but maybe aoe2.net is rejecting this with user-agent or some other environment einformation.

CraftySalamander commented 1 year ago

Thanks for the report.

When fetching data, from aoe2.net these last months, I usually only get old matches.

For instance, https://aoe2.net/api/player/matches?game=aoe2de&profile_id=241994&count=1 should return my last match, but returns one from 9 days ago (same as what is on https://aoe2.net/#aoe2de-profile-241994), despite the fact that I played several games Yesterday and 3 days ago.

I have the impression that aoe2.net is not very reliable these last months. aoe2insights.com seems to be more up to date, but only provides data fetching for nightbot.

What is the ID you are trying to retrieve?

Ponpok0 commented 1 year ago

Thank you for your reply. 10530965 is the ID I'm trying to retrieve.

aoe2.net returns correct json of yesterday's match with direct api url in chrome.

CraftySalamander commented 1 year ago

I see that aoe2.net seems to better perform updates for your ID. I can check with the overlay and your ID later.

In case you are familiar with Python, you can already try the code here

Ponpok0 commented 1 year ago

OK. The cause of problem is aoe2.net doesn't the map correctly. I think the following fixes will fix it.

Line 309
        # find selected map
        for map_type in aoe2_net_parameters['map_type']:
            if map_type['id'] == last_match['map_type']:
                data.map_name = map_type['string']
                break

to

        # find selected map
        for map_type in aoe2_net_parameters['map_type']:
            if  'map_type' not in last_match:
                data.map_name = 'unknown'
                break
            if map_type['id'] == last_match['map_type']:
                data.map_name = map_type['string']
                break
Ponpok0 commented 1 year ago

I reviewed it and it was also "Unkown" on aoe2.net from a few days ago.

CraftySalamander commented 1 year ago

Thank you.

This indeed seems to solve issues when I tested with other IDs. I implemented it here, similarly to what you suggested.

I uploaded a temporary release, so that you can check if it solves your issue. You can download it here: https://github.com/CraftySalamander/RTS_Overlay/releases/download/1.5.1/aoe2_overlay-1.5.2.zip

Ponpok0 commented 1 year ago

Thank you for your swift response.

I have confirmed that the problem has been solved. I will continue to have fun with aoe2 along with your great work.

CraftySalamander commented 1 year ago

Great! Thank you for the feedback and the bug report.