Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
In search.py in the xgoogle folder, look for two methods named _extract_results and _extract_description .
Change the assignment variables for results and desc_div to the new ones given. Old code has been commented out below and new code is present. Thanks securda!!! This works like a charm. :)
First method to change: def _extract_results(self, soup):
#results = soup.findAll('li', {'class': 'g'})
results = soup.findAll('li','g')
Second method to change: def _extract_description(self, result):
#desc_div = result.find('div', {'class': re.compile(r'\bs\b')})
desc_div = result.find('span', 'st')
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
Education Sponsors
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
Hi Securda! Where should I add this in search.py? Thanks very much!
Comment Responses
In search.py in the xgoogle folder, look for two methods named _extract_results and _extract_description .
Change the assignment variables for results and desc_div to the new ones given. Old code has been commented out below and new code is present. Thanks securda!!! This works like a charm. :)
First method to change:
def _extract_results(self, soup):#results = soup.findAll('li', {'class': 'g'})
results = soup.findAll('li','g')
Second method to change:
def _extract_description(self, result):#desc_div = result.find('div', {'class': re.compile(r'\bs\b')})
desc_div = result.find('span', 'st')
i checked out master on github recently and this hack is still needed. afterwards it works great. thanks
Reply To This Comment