LuanRT / google-this

A simple yet powerful module to retrieve organic search results and much more from Google.
https://www.npmjs.com/package/googlethis
MIT License
320 stars 77 forks source link

v1.4.0 searching for images returns this error. it was working before #35

Closed aymenitc closed 1 year ago

aymenitc commented 1 year ago

Steps to reproduce

hello, I just test this simple code and it returns error:

const images = await googlethis.image('The Wolf Among Us', { safe: false });
console.log(images); 

Failure Logs

TypeError: Cannot read properties of null (reading '1')
at Object.image in googlethis/lib/core/main.js

Expected behavior

it was working before as it return json results of search images

Current behavior

it produces this error

Version

Default

Anything else?

No response

Checklist

danrfq commented 1 year ago

Same issue here.

LuanRT commented 1 year ago

Hey everyone, sorry for the delay ~ Seems like the structure of the response changed, I'll try to reproduce & fix this later today. Thanks!

Edit: Or maybe a few parameters are missing in the request? In the previous version we would always include _reqid and f.sid in the request, but now those are always set to -0 (I thought they weren't important). I'll revert that change and publish a new version to NPM.

Edit 2: Done, please try v1.4.1 and let me know if it still errors out.

danrfq commented 1 year ago

I got this error:

Uncaught SearchError: Unknown error
    at Object.image (\googlethis\lib\core\main.js:210:11)

The code is just (async () => { await google.image("google") })().

LuanRT commented 1 year ago

I got this error:

Uncaught SearchError: Unknown error
    at Object.image (\googlethis\lib\core\main.js:210:11)

The code is just (async () => { await google.image("google") })().

Update to v1.4.3 and let me know if it works, it should support Google's latest response structure.

danrfq commented 1 year ago

It's working now! Thank you so much.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.