bgrnwd/fotmob

Example usage is not working correctly

Closed this issue · 11 comments

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):

  • OS: MacOS 12.5.1
  • Browser: Brave (Version 1.42.97 Chromium: 104.0.5112.102 (Official Build) (x86_64))

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.

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

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

@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!

@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.

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

would send screenshot soon

bgrnwd commented

@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

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

@bgrnwd maybe we should close it

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