baronet2 / FirstCyclingAPI

An unofficial Python API wrapper for firstcycling.com
https://firstcyclingapi.readthedocs.io/en/latest/
MIT License
25 stars 3 forks source link

RaceEditionResults endpoint broken #23

Open psemdel opened 1 year ago

psemdel commented 1 year ago

Hi, thx for the library, it is really helping. In race/race.py there is

self._get_endpoint(endpoint=RaceEditionResults, l=classification_num, e=zero_padded_stage_num)

And in constants.py I see classifications = {'general': 1, 'youth': 2, 'points': 3, 'mountain': 4, 'sprint': 6}

So I suppose that l=1 should give me the general. However, it does not. FirstCycling seems not to work anymore like that. Can you confirm the current state?

baronet2 commented 1 year ago

Hi, glad you're finding it useful.

I think you're right and the FirstCycling website has changed how these results work.

It looks like now you don't need to pass in the classification number, and instead all the classifications are returned in the original endpoint. I don't have time to try to fix the package right now, but if you get the beautiful soup for the page, I think you can get each of the classifications using soup.find_all('div', {'class': 'tab-content'}) and soup.find_all('div', {'class': 'tab-content results'}). If you know how beautiful soup works you may be able to update the package to handle this.

Would be very happy to accept a pull request fixing this issue, as I may not be able to get to it for a while.

psemdel commented 1 year ago

Hi, I had also a second look in the source code of the page (I thought only the "gc" one was displayed in the first place) and you are right, it is all there. Just need to adapt the parser. Concerning PR, I tried to open a new branch already on your repo, but it says it is forbidden. Right now, my small change is in one fork. I let you know, when I have something (this week for sure).

baronet2 commented 1 year ago

Fantastic! You're welcome to open a PR from your fork to my repo. Keep me posted 😄