on master help sign in
google engine: code cleanup
fc0ae0fDalf
searx/engines/google.py+3−19
@@ -124,9 +124,6 @@ image_img_src_xpath = './img/@src'
124# FIXME : no translation
124# FIXME : no translation
125property_address = "Address"
125property_address = "Address"
126property_phone = "Phone number"
126property_phone = "Phone number"
127−property_location = "Location"
128−property_website = "Web site"
129−property_gplus_website = "Google plus"
130
127
131# cookies
128# cookies
132pref_cookie = ''
129pref_cookie = ''
@@ -166,19 +163,6 @@ def parse_url(url_string, google_hostname):
166 return url_string
163 return url_string
167
164
168
165
169−# URL : get label
170−def url_get_label(url_string):
171− # sanity check
172− if url_string is None:
173− return url_string
174−
175− # normal case
176− parsed_url = urlparse(url_string)
177− if parsed_url.netloc == 'plus.google.com':
178− return property_gplus_website
179− return property_website
180−
181−
182# returns extract_text on the first result selected by the xpath or None
166# returns extract_text on the first result selected by the xpath or None
183def extract_text_from_dom(result, xpath):
167def extract_text_from_dom(result, xpath):
184 r = result.xpath(xpath)
168 r = result.xpath(xpath)
@@ -281,9 +265,9 @@ def response(resp):
281 # append result
265 # append result
282 results.append({'url': url,
266 results.append({'url': url,
283 'title': title,
267 'title': title,
284− 'content': content})
268+ 'content': content
269+ })
285− except Exception, e:
270+ except:
286− print e
287 continue
271 continue
288
272
289 # parse suggestion
273 # parse suggestion