TypeError: Cannot read property 'text' of undefined
chriseckman opened this issue · 2 comments
I'm getting a error here:
return b.getElementsByClassName('_gUb')[0].text()
^
Same issue for me
That's cause this is no proper image recognition package. If you guys look through the code, it's just doing a reverse image search on google and it's trying to extract the text that google associates it with. However the class of the element from google changes over time, and causes this problem...
If you want to use this, even though it's working just as a reverse image search on google, you can just edit that line in node_modules (or fork and create your own package out of this one) and replace in these lines https://github.com/xc0d3rz/npm-imagerecognition/blob/master/imagerecognition.js#L82 the class with the correct one that google is using (basically at the time of writing this message you should just replace _gUb with fKDtNb)