@@ -1,8 +1,8 @@
1−## Startpage (Web)
1+# Startpage (Web)
3# @website https://startpage.com
3# @website https://startpage.com
4# @provide-api no (nothing found)
4# @provide-api no (nothing found)
6# @using-api no
6# @using-api no
7# @results HTML
7# @results HTML
8# @stable no (HTML can change)
8# @stable no (HTML can change)
@@ -17,8 +17,11 @@ import re
18# engine dependent config
18# engine dependent config
19categories = ['general']
19categories = ['general']
20+# there is a mechanism to block "bot" search
21+# (probably the parameter qid), require
20−# there is a mechanism to block "bot" search (probably the parameter qid), require storing of qid's between mulitble search-calls
22+# storing of qid's between mulitble search-calls
21−#paging = False
24+# paging = False
22language_support = True
25language_support = True
24# search-url
27# search-url
@@ -40,11 +43,12 @@ def request(query, params):
40 params['url'] = search_url
43 params['url'] = search_url
41 params['method'] = 'POST'
44 params['method'] = 'POST'
42 params['data'] = {'query': query,
45 params['data'] = {'query': query,
43− 'startat': offset}
46+ 'startat': offset}
45 # set language if specified
48 # set language if specified
46 if params['language'] != 'all':
49 if params['language'] != 'all':
47− params['data']['with_language'] = 'lang_' + params['language'].split('_')[0]
50+ params['data']['with_language'] = ('lang_' +
51+ params['language'].split('_')[0])
49 return params
53 return params
@@ -54,10 +58,13 @@ def response(resp):
54 results = []
58 results = []
56 dom = html.fromstring(resp.content)
60 dom = html.fromstring(resp.content)
58 # parse results
62 # parse results
59 for result in dom.xpath(results_xpath):
63 for result in dom.xpath(results_xpath):
60− link = result.xpath(link_xpath)[0]
64+ links = result.xpath(link_xpath)
61 url = link.attrib.get('href')
68 url = link.attrib.get('href')
62 title = escape(link.text_content())
69 title = escape(link.text_content())
@@ -66,13 +73,14 @@ def response(resp):
68 if result.xpath('./p[@class="desc"]'):
75 if result.xpath('./p[@class="desc"]'):
69− content = escape(result.xpath('./p[@class="desc"]')[0].text_content())
76+ content = escape(result.xpath('./p[@class="desc"]')[0]
71 content = ''
79 content = ''
73 # append result
81 # append result
74− results.append({'url': url,
82+ results.append({'url': url,
75− 'title': title,
83+ 'title': title,
76 'content': content})
84 'content': content})
78 # return results
86 # return results