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

1.8.0 `{results:[]}` returning empty #66

Closed mrepol742 closed 3 months ago

mrepol742 commented 10 months ago

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

JaquesM commented 10 months ago

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

anomic30 commented 10 months ago

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

parag commented 10 months ago

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.

anomic30 commented 10 months ago

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!

haskx commented 8 months ago

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.

prakashgp commented 7 months ago

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

C00LVansh commented 7 months ago

Nothing worked for me

CROSP commented 6 months ago

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]',
github-actions[bot] commented 3 months 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.