bgrnwd / fotmob

:soccer: An unofficial JavaScript/TypeScript client for the FotMob API
MIT License
137 stars 18 forks source link

Example usage is not working correctly #352

Closed matthew2564 closed 8 months ago

matthew2564 commented 2 years ago

Describe the bug Using the example provided in the README.md returns a large HTML response (presumably from the error page of the FotMob website)

To Reproduce Steps to reproduce the behavior:

import Fotmob from 'fotmob';
const fotmob = new Fotmob();

fotmob.getMatchesByDate("20201020");
fotmob.getLeague("42", "overview", "league", "America/New_York");
fotmob.getTeam("6017", "overview", "team", "America/New_York");
fotmob.getPlayer("1071179");
fotmob.getMatchDetails("3399269");

Expected behavior Expected getPlayer for example to return me a JSON payload.

Screenshots

Screenshot 2022-08-31 at 16 00 23

Desktop (please complete the following information):

bgrnwd commented 2 years ago

Thanks for reporting this, I'll do some more investigation over the weekend. On first glance, it seems like this may be an API change.

bgrnwd commented 2 years ago

Confirmed it's an API change. I should be able to publish a version with the fix in the next couple days.

bgrnwd commented 2 years ago

@matthew2564 Give 1.0.4 a try and let me know if that fixes it

matthew2564 commented 2 years ago

@bgrnwd Bumped version to 1.0.4. Seem to have encountered s second issue.

Updated the example usage, and implemented the following code...

Screenshot 2022-09-22 at 07 49 13

This is the output when executing the above code

Screenshot 2022-09-22 at 07 50 22

The README.md suggests the methods should return a value, but upon running the code and looking at the type definitions, the methods return void.

Screenshot 2022-09-22 at 07 58 07

Any help is appreciated, thanks!

bgrnwd commented 2 years ago

@matthew2564 Hmm, the methods should return a value. Full disclosure, I'm not a JS/TS dev so I'm learning as I go. I'll see if I can figure out why. I did notice the type definition file is empty now too.

I've been meaning to switch to a logger instead of printing to the console so the URL, undefined and false will go away eventually.

olamarvel commented 1 year ago

i think this is due to the compiler you used if yoou checked the compiled code in dist/fotmob.js u will see that each fucntion is being called in a self involking function with does not allow for returned values

olamarvel commented 1 year ago

would send screenshot soon

bgrnwd commented 1 year ago

@olamarvel Thanks for the info and PR. I made the changes you suggested in #404

@matthew2564 Give 1.1.0 a try, I think I've got the example usage working this time

bgrnwd commented 8 months ago

@matthew2564 Want to give this a try again? There's been a couple new versions since July

ItamarShDev commented 8 months ago

@bgrnwd maybe we should close it

bgrnwd commented 8 months ago

@matthew2564 Going to close this but happy to re-open it if you're still having the same issue with the newer versions.