From 1dd35e9916dabd5426f92e5e0921148b439bb376 Mon Sep 17 00:00:00 2001 From: pw3t Date: Sun, 19 Jan 2014 21:20:07 +0100 Subject: [PATCH 1/2] [ehn] added ixquick engine, using startpage engine --- searx/engines/startpage.py | 11 ++++++++--- settings.yml | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py index 87c091e2d..f1ff76292 100644 --- a/searx/engines/startpage.py +++ b/searx/engines/startpage.py @@ -3,8 +3,8 @@ from lxml import html from urlparse import urlparse from cgi import escape -base_url = 'https://startpage.com/' -search_url = base_url+'do/search' +base_url = None +search_url = None def request(query, params): global search_url @@ -26,6 +26,11 @@ def response(resp): url = link.attrib.get('href') parsed_url = urlparse(url) title = link.text_content() - content = result.xpath('./p[@class="desc"]')[0].text_content() + + content ='' + if len(result.xpath('./p[@class="desc"]')): + content = result.xpath('./p[@class="desc"]')[0].text_content() + results.append({'url': url, 'title': title, 'content': content}) + return results diff --git a/settings.yml b/settings.yml index b7c82cc72..bebee020c 100644 --- a/settings.yml +++ b/settings.yml @@ -68,6 +68,13 @@ engines: - name : startpage engine : startpage + base_url : 'https://startpage.com/' + search_url : 'https://startpage.com/do/search' + + - name : ixquick + engine : startpage + base_url : 'https://www.ixquick.com/' + search_url : 'https://www.ixquick.com/do/search' - name : twitter engine : twitter From a01042ae616524160f32bfbca0e833b1de6dab58 Mon Sep 17 00:00:00 2001 From: pw3t Date: Sun, 19 Jan 2014 21:20:07 +0100 Subject: [PATCH 2/2] [ehn] added ixquick engine, using startpage engine --- searx/engines/startpage.py | 11 ++++++++--- searx/settings_robot.yml | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py index d6d7cf44d..756e1670f 100644 --- a/searx/engines/startpage.py +++ b/searx/engines/startpage.py @@ -1,8 +1,8 @@ from urllib import urlencode from lxml import html -base_url = 'https://startpage.com/' -search_url = base_url+'do/search' +base_url = None +search_url = None def request(query, params): @@ -24,6 +24,11 @@ def response(resp): link = result.xpath('.//h3/a')[0] url = link.attrib.get('href') title = link.text_content() - content = result.xpath('./p[@class="desc"]')[0].text_content() + + content ='' + if len(result.xpath('./p[@class="desc"]')): + content = result.xpath('./p[@class="desc"]')[0].text_content() + results.append({'url': url, 'title': title, 'content': content}) + return results diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index d60ed3272..f7f2fa903 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -68,6 +68,13 @@ engines: - name : startpage engine : startpage + base_url : 'https://startpage.com/' + search_url : 'https://startpage.com/do/search' + + - name : ixquick + engine : startpage + base_url : 'https://www.ixquick.com/' + search_url : 'https://www.ixquick.com/do/search' - name : twitter engine : twitter