summaryrefslogtreecommitdiff
path: root/searx/engines/xpath.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-04-14 10:59:31 +0200
committerAdam Tauber <asciimoo@gmail.com>2016-04-14 10:59:31 +0200
commit85c0351dca086c5f652c34048fef290b09e088d9 (patch)
treec45b0cee0f2a4e13704ed376701cbdcbe1e00b27 /searx/engines/xpath.py
parent5544fdb75610bb66d05392289e0f0ad48c13ccf6 (diff)
parent90c51cb4494c90353cc97794eece486bd8bf92dd (diff)
Merge pull request #526 from ukwt/anime
Add a few search engines
Diffstat (limited to 'searx/engines/xpath.py')
-rw-r--r--searx/engines/xpath.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
index f51634be0..e701c02bf 100644
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -11,6 +11,14 @@ title_xpath = None
suggestion_xpath = ''
results_xpath = ''
+# parameters for engines with paging support
+#
+# number of results on each page
+# (only needed if the site requires not a page number, but an offset)
+page_size = 1
+# number of the first page (usually 0 or 1)
+first_page_num = 1
+
'''
if xpath_results is list, extract the text from each result and concat the list
@@ -76,8 +84,14 @@ def normalize_url(url):
def request(query, params):
query = urlencode({'q': query})[2:]
- params['url'] = search_url.format(query=query)
+
+ fp = {'query': query}
+ if paging and search_url.find('{pageno}') >= 0:
+ fp['pageno'] = (params['pageno'] + first_page_num - 1) * page_size
+
+ params['url'] = search_url.format(**fp)
params['query'] = query
+
return params