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

standard-search: Fix parsing of description and divs with the results #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kulla
Copy link

@kulla kulla commented 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 #92
Closes #88
Closes #84
Closes #94

With this fix the parsing seems to work (for now - I guess it will break soon when Google changes their design):

In [53]: for i in range(40):
    ...:     results = googleapi.standard_search.search("albert einstein")
    ...:     print("%s - %s" % (len(results), results[0].link))
    ...:     time.sleep(2)
    ...:     
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
9 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein
10 - https://de.wikipedia.org/wiki/Albert_Einstein

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant