logo

searx

Unnamed repository; edit this file 'description' to name the repository.
commit: 805e6f1884a969e4134d3049281e49c005bca551
parent: 1fd91bd911ef07ca32461a063c5560a68d88c2ac
Author: asciimoo <asciimoo@gmail.com>
Date:   Thu, 30 Jan 2014 00:50:47 +0100

[enh] paging support for youtube

Diffstat:

searx/engines/youtube.py | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py @@ -3,11 +3,15 @@ from urllib import urlencode categories = ['videos'] -search_url = 'https://gdata.youtube.com/feeds/api/videos?alt=json&{query}' +search_url = 'https://gdata.youtube.com/feeds/api/videos?alt=json&{query}&start-index={index}&max-results=25' # noqa + +paging = True def request(query, params): - params['url'] = search_url.format(query=urlencode({'q': query})) + index = (params['pageno'] - 1) * 25 + 1 + params['url'] = search_url.format(query=urlencode({'q': query}), + index=index) return params