Replace Direct Xpath for Google Search

This commit is contained in:
ConstrictM 2022-07-17 01:18:59 -04:00 committed by GitHub
parent 29ab970bad
commit dbae03e890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,7 +252,7 @@ def google_parse_results(root, raw, log=prints):
cache_url_map = google_extract_cache_urls(raw)
# print('\n'.join(cache_url_map))
ans = []
for div in root.xpath('//*[@id="search"]//*[@id="rso"]//*[@class="kWxLod" or @class="hlcw0c"]'):
for div in root.xpath('//*[@id="search"]//*[@id="rso"]//div[descendant::h3]'):
try:
a = div.xpath('descendant::a[@href]')[0]
except IndexError: