LuanRT / google-this

A simple yet powerful module to retrieve organic search results and much more from Google.

Home Page:https://www.npmjs.com/package/googlethis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.7.1 Search() function returning empty result list regardless of image passed

SOME-1HING opened this issue · comments

Steps to reproduce

import fs from "fs/promises";
import google from "googlethis";

async function reverse(){
  const imageBuffer = await fs.readFile("./sample.jpg");
  const reverse = await google.search(imageBuffer, { ris: true });
  console.log(reverse);
};

reverse()

Failure Logs

{
  results: [],
  videos: [],
  knowledge_panel: KnowledgeGraph {
    type: null,
    title: null,
    description: null,
    url: null,
    metadata: [],
    books: [],
    tv_shows_and_movies: [],
    ratings: [],
    available_on: [],
    images: [],
    songs: [],
    socials: [],
    demonstration: null,
    lyrics: null
  },
  featured_snippet: FeaturedSnippet { title: null, description: null, url: null },
  did_you_mean: null,
  weather: Weather {
    location: null,
    forecast: null,
    precipitation: null,
    humidity: null,
    temperature: null,
    wind: null,
    image: null
  },
  time: Time { hours: null, date: null },
  location: Location { title: null, distance: null, map: null },
  dictionary: Dictionary {
    word: null,
    phonetic: null,
    audio: null,
    definitions: [],
    examples: []
  },
  translation: Translation {
    source_language: null,
    target_language: null,
    source_text: null,
    target_text: null
  },
  top_stories: [],
  unit_converter: Converters {},
  people_also_ask: [],
  people_also_search: []
}
Error: TypeError: Cannot read properties of undefined (reading 'url')
    at Object.reverse (file:///C:/Users/***/Documents/GitHub/telegram-js-bot/src/GReverse.js:29:50)
    at async Object.callback (file:///C:/Users/***/Documents/GitHub/telegram-js-bot/index.js:57:20)

Expected behavior

I was expecting the search() function to return a non-empty array with the search results, such as an array of image URLs or other relevant data. Specifically, I was not expecting the result to be an empty array like {results: []}.

Current behavior

The current behavior is that the search() function is consistently returning an empty results list, represented as an empty array like {results: []}, regardless of the image that is passed as an argument. I have tested the function with multiple images, including those that were previously working before April, but it is still returning an empty results array.

Version

Default

Anything else?

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.
commented

Same issue over here. Although, it seems they already know about it as there is already a closed issue on it

same issue

For anyone reading this, sorry for the silence in this repo. I want to fix all the bugs and migrate it to TypeScript at some point but I always end up forgetting about it.

Yes please changing to typescript will be heaven

has there been any update on this? i have the same issue right now, but would to make this work!

edit: looked into this a little bit further by inserting some console.logs on the main.js. it turns out that for me google is blocking my requests and shows a a captcha page.

I'm also experiencing the same issue.

It seems also happens on non image search. Any updates? @LuanRT

I think they've changed the tag for the description:
This returns no results:

const descriptions = $(Constants.SELECTORS.DESCRIPTION)

Resulting in statement this being false:

if (titles[i] && descriptions[i] && urls[i]) {

Which means the results are never populated
Sorry don't know enough javascript to make fix

this issue renders the entire package unusable, hoping a fix is applied soon

is the fix going to be merged any time soon?

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.