Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 12f891da authored by Alexandre Flament's avatar Alexandre Flament Committed by GitHub
Browse files

Merge pull request #1669 from dalf/engine-fixes

Engine fixes
parents 91a59ff3 1cee2c17
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ def request(query, params):
    # basic search
    offset = (params['pageno'] - 1) * number_of_results

    string_args = dict(query=query,
    string_args = dict(query=query.decode('utf-8'),
                       offset=offset,
                       number_of_results=number_of_results)

+0 −2
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ def request(query, params):

    params['url'] = base_url + search_path

    params['headers']['User-Agent'] = gen_useragent('Windows NT 6.3; WOW64')

    return params


+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ from searx.utils import is_valid_lang
from searx.url_utils import urljoin

categories = ['general']
url = u'http://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
url = u'https://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
weight = 100

parser_re = re.compile(b'.*?([a-z]+)-([a-z]+) ([^ ]+)$', re.I)
+14 −15
Original line number Diff line number Diff line
@@ -18,13 +18,13 @@ categories = ['files']
paging = True

# search-url
base_url = 'https://f-droid.org/'
search_url = base_url + 'repository/browse/?{query}'
base_url = 'https://search.f-droid.org/'
search_url = base_url + '?{query}'


# do search-request
def request(query, params):
    query = urlencode({'fdfilter': query, 'fdpage': params['pageno']})
    query = urlencode({'q': query, 'page': params['pageno'], 'lang': ''})
    params['url'] = search_url.format(query=query)
    return params

@@ -35,17 +35,16 @@ def response(resp):

    dom = html.fromstring(resp.text)

    for app in dom.xpath('//div[@id="appheader"]'):
        url = app.xpath('./ancestor::a/@href')[0]
        title = app.xpath('./p/span/text()')[0]
        img_src = app.xpath('.//img/@src')[0]

        content = extract_text(app.xpath('./p')[0])
        content = content.replace(title, '', 1).strip()

        results.append({'url': url,
                        'title': title,
                        'content': content,
                        'img_src': img_src})
    for app in dom.xpath('//a[@class="package-header"]'):
        app_url = app.xpath('./@href')[0]
        app_title = extract_text(app.xpath('./div/h4[@class="package-name"]/text()'))
        app_content = extract_text(app.xpath('./div/div/span[@class="package-summary"]')).strip() \
            + ' - ' + extract_text(app.xpath('./div/div/span[@class="package-license"]')).strip()
        app_img_src = app.xpath('./img[@class="package-icon"]/@src')[0]

        results.append({'url': app_url,
                        'title': app_title,
                        'content': app_content,
                        'img_src': app_img_src})

    return results
+8 −8
Original line number Diff line number Diff line
@@ -204,11 +204,11 @@ engines:
  - name : etymonline
    engine : xpath
    paging : True
    search_url : http://etymonline.com/?search={query}&p={pageno}
    url_xpath : //a[contains(@class, "word--")]/@href
    title_xpath : //p[contains(@class, "word__name--")]/text()
    content_xpath : //section[contains(@class, "word__defination")]/object
    first_page_num : 0
    search_url : https://etymonline.com/search?page={pageno}&q={query}
    url_xpath : //a[contains(@class, "word__name--")]/@href
    title_xpath : //a[contains(@class, "word__name--")]
    content_xpath : //section[contains(@class, "word__defination")]
    first_page_num : 1
    shortcut : et
    disabled : True

@@ -703,9 +703,9 @@ engines:
    shortcut: vo
    categories: social media
    search_url : https://searchvoat.co/?t={query}
    url_xpath : //div[@class="entry"]/p/a[@class="title"]/@href
    title_xpath : //div[@class="entry"]/p/a[@class="title"]
    content_xpath : //div[@class="entry"]/p/span[@class="domain"]
    url_xpath : //div[@class="entry"]/p/a[contains(@class, "title")]/@href
    title_xpath : //div[@class="entry"]/p/a[contains(@class, "title")]
    content_xpath : //div[@class="entry"]/p/span[@class="domain"]/a/text()
    timeout : 10.0
    disabled : True

Loading