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.8.0 `{results:[]}` returning empty

mrepol742 opened this issue · comments

Steps to reproduce

const google = require('googlethis');

const response = await google.search('googlethis', {page: 0});
console.log(response);

Failure Logs

{"results":[],"videos":[],"knowledge_panel":{"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":{"title":null,"description":null,"url":null},"did_you_mean":null,"weather":{"location":null,"forecast":null,"precipitation":null,"humidity":null,"temperature":null,"wind":null,"image":null},"time":{"hours":null,"date":null},"location":{"title":null,"distance":null,"map":null},"dictionary":{"word":null,"phonetic":null,"audio":null,"definitions":[],"examples":[]},"translation":{"source_language":null,"target_language":null,"source_text":null,"target_text":null},"top_stories":[],"unit_converter":{},"people_also_ask":[],"people_also_search":[]}

Expected behavior

I am expecting the {results[]} to return an array of webpages consist of urls, descriptions and favicons of the webpages.`

Current behavior

It returned empty {results: []}

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.

Same error here. It was working perfectly but this week it started to return an empty list

I can see only the knowledge panel and the "people also ask" section. Everything else appears to be empty/null.

Have done a quick hack replacing SELECTORS with below in constants.js since Google has done some changes.

SELECTORS: {
// Organic Search Results
TITLE: 'div.q8U8x.oewGkc.LeUQr',
DESCRIPTION: 'div.MUxGbd.yDYNvb',
URL: 'a.C8nzq.BmP5tf',

This is for if you are just scraping the pages. For other elements, obviously have to do deeper research and do changes.

Have done a quick hack replacing SELECTORS with below in constants.js since Google has done some changes.

SELECTORS: { // Organic Search Results TITLE: 'div.q8U8x.oewGkc.LeUQr', DESCRIPTION: 'div.MUxGbd.yDYNvb', URL: 'a.C8nzq.BmP5tf',

This is for if you are just scraping the pages. For other elements, obviously have to do deeper research and do changes.

Thanks it works!

Have done a quick hack replacing SELECTORS with below in constants.js since Google has done some changes.

SELECTORS: { // Organic Search Results TITLE: 'div.q8U8x.oewGkc.LeUQr', DESCRIPTION: 'div.MUxGbd.yDYNvb', URL: 'a.C8nzq.BmP5tf',

This is for if you are just scraping the pages. For other elements, obviously have to do deeper research and do changes.

how can i change the file and work?pls.

This fix worked for me #73

Updated description selector (Constants.SELECTORS.DESCRIPTION) in file /lib/utils/constants.js to div[data-snc] > div:nth-child(2) > div

Nothing worked for me

The issue is related to changed selectors, try my fork - https://github.com/CROSP/google-this/tree/main

Or use the following selectors by directly changing the contants.js file

  SELECTORS: {
    // Organic Search Results 
    TITLE: 'a[role="presentation"][ping][data-ved] div[aria-level="3"][role="heading"]',
    DESCRIPTION: 'div[data-sncf="1"] div',
    URL: 'a[role="presentation"][ping][data-ved]',

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.