boxrec: Uncaught TypeError TypeError: $ is not a function When trying to get "output" or "links"
Hi @mikedidomizio I really appreciated your effort to upgrade this package continuously.
Btw, I found this error when I tried to get "output" or "links" field.
This is my code.
let schedules = await boxrec.getSchedule(cookieJar, {
countryCode: '',
});
console.log(schedules.events[0].bouts[0].links);
... OR
let schedules = await boxrec.getDate(cookieJar, {
day: 19,
month: 4,
year: 2022
});
console.log(schedules.output.events[0].bouts[0].output);
And when I try to access to the “links” or “output” field to get bout_id like above ones, it just gives this error for some reason.
I was able to access to them in the previous version but they were just null for some reason.
Uncaught TypeError TypeError: $ is not a function
at o.parseLinksColumn (c:\boxrec\node_modules\boxrec\dist\boxrec-common-tables\boxrec-common-links.js:1:353)
at <anonymous> (c:\boxrec\node_modules\boxrec\dist\boxrec-common-tables\boxrec-common-links.js:1:243)
at each (c:\boxrec\node_modules\cheerio\lib\api\traversing.js:480:26)
at o.parseLinkInformation (c:\boxrec\node_modules\boxrec\dist\boxrec-common-tables\boxrec-common-links.js:1:216)
at get (c:\boxrec\node_modules\boxrec\dist\boxrec-pages\event\boxrec.page.event.bout.row.js:1:2308)
...
Not sure If I will need to install another package with boxrec package.
Could you please check this issue? Thanks
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Great It worked as a charm.
Thank you very much
Hi @mikedidomizio
Thanks for the updates. But it still doesn’t appear working.
I made a very simple script as it still gave the errors on my old code. This is my simple script.
And this is my package.json
Please note that I also installed
form-datapackage because it gave an error (Cannot find module form-data) when I installed only theboxrecpackage.When I run the code, I can still see this error.
Thanks
Let’s try boxrec@8.0.3. I think it was the way CheerioJS was imported for that file and not loaded like the others. It doesn’t explain why it worked for me and not for you but I’m hoping this gets us past the problem you’re seeing.
Hey there,
Can you try
boxrec@8.0.2? I’ve addedform-datatoboxrec-requests. I think it appeared fine to me but was actually a problem.I never experienced the Cheerio errors you experienced. Which is weird.
If you still experience errors, give me whatever script you’re using.
I published 8.0.1, that I hope addresses the problem.
This was my testing script, and perhaps in the future I’ll ask for the script beforehand.
this was the after output (good links)
Otherwise if this doesn’t fix it send me the exact script and expected outputs. Anything else as well.
Then wait.
I haven’t had time to look at it. Will comment here when there is an update.
Thanks for your checking the issue.
This is my code I just tested with.
And the response is like this.
Then I tried to get the first bout of the first event.
schedules.events[0].bouts[0]Lastly I tried to get the output of the bout, then it throws this error.
schedules.events[0].bouts[0].outputWhen I tried to get the links directly, it was also giving the same error above.
schedules.events[0].bouts[0].linksI also confirmed I am using the latest version(8.0.0).
Thanks
Okay,
getDate,outputmay be broken. The problem withoutputis that it has to grab all the data, and if one is to throw, it in fact wrecks everything.TypeError: $ is not a function- means it’s an issue with Cheerio coming fromboxrec-common-links. If I had to quickly guess it’s probably here which is the issue. Almost guaranteed.Nope, the package should work alone. All the links pass through that class I posted above for parsing. When
outputis working, it’s great, when it’s not, well the fallback is to get individual chunks of info. Although that might not matter in this scenario.No ETA on this. Hopefully sooner, but probably a few weeks. Just due to other projects and life. There’s enough information in this comment that someone could pick it up and fix it though.