diff options
| author | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2014-12-29 21:31:04 +0100 |
|---|---|---|
| committer | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2014-12-29 21:31:04 +0100 |
| commit | 5d977056f7aa216eae09a22c3baaff73546f6ff1 (patch) | |
| tree | ffd08f6bc1d3268ec6ce8031cbdec7987dfd3763 /searx/engines/flickr.py | |
| parent | 576fdef440e835592f9f5c8dc25398e343687c7a (diff) | |
Flake8 and Twitter corrections
Lots of Flake8 corrections
Maybe we should change the rule to allow lines of 120 chars. It seems more usable.
Big twitter correction : now it outputs the words in right order...
Diffstat (limited to 'searx/engines/flickr.py')
| -rw-r--r-- | searx/engines/flickr.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/searx/engines/flickr.py b/searx/engines/flickr.py index 2fa5ed7ec..4dadd80a6 100644 --- a/searx/engines/flickr.py +++ b/searx/engines/flickr.py @@ -1,10 +1,10 @@ #!/usr/bin/env python ## Flickr (Images) -# +# # @website https://www.flickr.com -# @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html) -# +# @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html) +# # @using-api yes # @results JSON # @stable yes @@ -18,16 +18,20 @@ categories = ['images'] nb_per_page = 15 paging = True -api_key= None +api_key = None -url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key={api_key}&{text}&sort=relevance&extras=description%2C+owner_name%2C+url_o%2C+url_z&per_page={nb_per_page}&format=json&nojsoncallback=1&page={page}' +url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search' +\ + '&api_key={api_key}&{text}&sort=relevance' +\ + '&extras=description%2C+owner_name%2C+url_o%2C+url_z' +\ + '&per_page={nb_per_page}&format=json&nojsoncallback=1&page={page}' photo_url = 'https://www.flickr.com/photos/{userid}/{photoid}' paging = True + def build_flickr_url(user_id, photo_id): - return photo_url.format(userid=user_id,photoid=photo_id) + return photo_url.format(userid=user_id, photoid=photo_id) def request(query, params): @@ -40,7 +44,7 @@ def request(query, params): def response(resp): results = [] - + search_results = loads(resp.text) # return empty array if there are no results @@ -64,11 +68,14 @@ def response(resp): url = build_flickr_url(photo['owner'], photo['id']) title = photo['title'] - - content = '<span class="photo-author">'+ photo['ownername'] +'</span><br />' - - content = content + '<span class="description">' + photo['description']['_content'] + '</span>' - + + content = '<span class="photo-author">' +\ + photo['ownername'] +\ + '</span><br />' +\ + '<span class="description">' +\ + photo['description']['_content'] +\ + '</span>' + # append result results.append({'url': url, 'title': title, |