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

Commit 35ecb6ec authored by asciimoo's avatar asciimoo
Browse files

[enh] paging support for mediawiki

parent 81b4cc77
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3,13 +3,15 @@ from urllib import urlencode, quote

url = 'https://en.wikipedia.org/'

search_url = url + 'w/api.php?action=query&list=search&{query}&srprop=timestamp&format=json'  # noqa
search_url = url + 'w/api.php?action=query&list=search&{query}&srprop=timestamp&format=json&sroffset={offset}'  # noqa

number_of_results = 10


def request(query, params):
    params['url'] = search_url.format(query=urlencode({'srsearch': query}))
    offset = (params['pageno'] - 1) * 10
    params['url'] = search_url.format(query=urlencode({'srsearch': query}),
                                      offset=offset)
    return params


+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ engines:
    engine : mediawiki
    url    : https://en.wikipedia.org/
    number_of_results : 1
    paging : False

  - name : bing
    engine : bing