You're viewing a comment by amions and its responses.

amions Permalink
May 19, 2010, 02:05

Yes, Google search redesigned the structure of the sum of search results which is located on the right top of the search page.
Google would return the begin and end number of the all search result in plain text at before, while now this numbers have been changed by script.

And these changes could influence the xgoogle's function "_extract_info(self, soup)" in the file ""

The crude solution I have taken as following:Change the function get_results(self)" in the file ""

Wish this will helpful for you ~

def get_results(self):
""" Gets a page of results """
if self.eor:
return []
MAX_VALUE = 1000000
page = self._get_results_page()
#search_info = self._extract_info(page)
results = self._extract_results(page)
search_info = {'from': self.results_per_page*self._page, \
'to': self.results_per_page*self._page + len(results),
'total': MAX_VALUE}
if not self.results_info:
self.results_info = search_info
if self.num_results == 0:
self.eor = True
return []
if not results:
self.eor = True
return []
if self._page > 0 and search_info['from'] == self._last_from:
self.eor = True
return []
if search_info['to'] == search_info['total']:
self.eor = True
self._page += 1
self._last_from = search_info['from']
return results

Comment Responses

May 21, 2010, 07:12

Hi thanks for the patch but I can't figure out the formatting. Can you post the patch again with correct formatting? Use <pre> ... </pre> to wrap the code. Thanks!

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "network_139": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.