Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search_results taking empty list values #92

Open
Scotchex opened this issue Feb 2, 2021 · 3 comments · May be fixed by #93
Open

search_results taking empty list values #92

Scotchex opened this issue Feb 2, 2021 · 3 comments · May be fixed by #93

Comments

@Scotchex
Copy link

Scotchex commented Feb 2, 2021

For 90% of the time the search_results list is taking empty values in hence, i am facing out of range errors.
Here is an example of the code that only works 10% of the time:

`from googleapi import google
def googleSearch(searchterm):
num_page = 1
search_results = google.search(searchterm, num_page)
return search_results[0].description

x = input('search?')
print(googleSearch(x))`

kulla added a commit to kulla/Google-Search-API that referenced this issue Feb 10, 2021
Google has introduced new formats for their result page (I got at least
4 different page formats in my tests). This commit fixes the parsing for
those four different formats for the description field. The parsing of
other attributes like cache_link is still broken.

Closes abenassi#92
Closes abenassi#88
Closes abenassi#84
@kulla
Copy link

kulla commented Feb 10, 2021

I got the same error. The reason is that Google made changes to their design and the HTML structure and thus the parsing failed. Since they use A/B testing for sure (X% of users get one design and other Y% of users get another design). Sometimes the parsing fails and sometimes not (the old design seem to be returned in 10% of the cases). I got at least 4 different HTML structures when I tested it. #93 includes a fix for that...

@batman616
Copy link

i got the same, i'm trying to use it but the result is just an empty list.

from googleapi import google
num_page = 1
search_results = google.search("my query", num_page)
print(search_results)

did i miss some thing ? please help me, thank you so much.

@danielcshn
Copy link

Still doesn't work, seems deprecated no longer supported.

from googleapi import google
num_page = 1
search_results = google.search("google", num_page)

print(search_results)

for result in search_results:
    print(result.link)

Result:

[]
[Finished in 1.2s]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants