diff options
| author | asciimoo <asciimoo@gmail.com> | 2014-01-19 22:39:56 +0100 |
|---|---|---|
| committer | asciimoo <asciimoo@gmail.com> | 2014-01-19 22:39:56 +0100 |
| commit | bfdd6ebb9292f544736ed264a8d8ab04ca8d0296 (patch) | |
| tree | a0f0b92552219a46ccc4cd933fd41816144381ca /searx/engines | |
| parent | dcbf17f57010b942a29b6a28555ec031eea5cf5b (diff) | |
| parent | 380b440a55ba3b8ec1430843226fa6b4b0dfe289 (diff) | |
Merge branch 'featured_result' of https://github.com/pw3t/searx
Diffstat (limited to 'searx/engines')
| -rw-r--r-- | searx/engines/mediawiki.py | 2 | ||||
| -rw-r--r-- | searx/engines/vimeo.py | 10 | ||||
| -rw-r--r-- | searx/engines/youtube.py | 11 |
3 files changed, 18 insertions, 5 deletions
diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py index d4b3fd843..00ad0f106 100644 --- a/searx/engines/mediawiki.py +++ b/searx/engines/mediawiki.py @@ -14,5 +14,7 @@ def request(query, params): def response(resp): search_results = loads(resp.text) res = search_results.get('query', {}).get('search', []) + return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), 'title': result['title']} for result in res[:int(number_of_results)]] + diff --git a/searx/engines/vimeo.py b/searx/engines/vimeo.py index 52c89ffdd..35bc3d50a 100644 --- a/searx/engines/vimeo.py +++ b/searx/engines/vimeo.py @@ -35,7 +35,11 @@ def response(resp): for result in dom.xpath(results_xpath): url = base_url + result.xpath(url_xpath)[0] title = p.unescape(extract_text(result.xpath(title_xpath))) - content = '<a href="{0}"> <img src="{2}"/> </a>'.format(url, title, extract_text(result.xpath(content_xpath)[0])) - results.append({'url': url, 'title': title, 'content': content}) - + thumbnail = extract_text(result.xpath(content_xpath)[0]) + content = '<a href="{0}"> <img src="{2}"/> </a>'.format(url, title, thumbnail) + results.append({'url': url + , 'title': title + , 'content': content + , 'template':'videos.html' + , 'thumbnail': thumbnail}) return results diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py index 1331f480e..cefdb6536 100644 --- a/searx/engines/youtube.py +++ b/searx/engines/youtube.py @@ -26,14 +26,21 @@ def response(resp): url = url[:-1] title = result['title']['$t'] content = '' + + thumbnail = '' if len(result['media$group']['media$thumbnail']): - content += '<a href="{0}" title="{0}" ><img src="{1}" /></a>'.format(url, result['media$group']['media$thumbnail'][0]['url']) + thumbnail = result['media$group']['media$thumbnail'][0]['url'] + content += '<a href="{0}" title="{0}" ><img src="{1}" /></a>'.format(url, thumbnail) if len(content): content += '<br />' + result['content']['$t'] else: content = result['content']['$t'] - results.append({'url': url, 'title': title, 'content': content}) + results.append({'url': url + , 'title': title + , 'content': content + , 'template':'videos.html' + , 'thumbnail':thumbnail}) return results |