forked from Ponysearch/Ponysearch
[ehn] add favicons for vimeo, soundcloud, twitter and youtube
This commit is contained in:
parent
fdb6fac214
commit
a8ec7fe6a4
8 changed files with 20 additions and 6 deletions
|
@ -14,5 +14,13 @@ def request(query, params):
|
||||||
def response(resp):
|
def response(resp):
|
||||||
search_results = loads(resp.text)
|
search_results = loads(resp.text)
|
||||||
res = search_results.get('query', {}).get('search', [])
|
res = search_results.get('query', {}).get('search', [])
|
||||||
|
|
||||||
return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')),
|
return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')),
|
||||||
'title': result['title']} for result in res[:int(number_of_results)]]
|
'title': result['title']} for result in res[:int(number_of_results)]]
|
||||||
|
|
||||||
|
if not len(res):
|
||||||
|
return results
|
||||||
|
for result in res[:int(number_of_results)]:
|
||||||
|
results.append({'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), 'title': result['title'], 'favicon':'wikipedia'})
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
BIN
searx/static/img/icon_soundcloud.png
Normal file
BIN
searx/static/img/icon_soundcloud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
searx/static/img/icon_twitter.png
Normal file
BIN
searx/static/img/icon_twitter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
searx/static/img/icon_vimeo.png
Normal file
BIN
searx/static/img/icon_vimeo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
BIN
searx/static/img/icon_youtube.png
Normal file
BIN
searx/static/img/icon_youtube.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% if result['favicon'] %}
|
{% if result['favicon'] %}
|
||||||
<div style="float:left; margin:2px;">
|
<div style="float:left; margin:2px;">
|
||||||
<img width="24" height="24" src="static/img/icon_{{result['favicon']}}.png" alt="{{result['favicon']}}.png" title="{{result['favicon']}}.png" />
|
<img width="18" height="18" src="static/img/icon_{{result['favicon']}}.png" alt="{{result['favicon']}}.png" title="{{result['favicon']}}.png" />
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
<div class="result">
|
<div class="result">
|
||||||
|
|
||||||
|
{% if result['favicon'] %}
|
||||||
|
<div style="float:left; margin:2px;">
|
||||||
|
<img width="18" height="18" src="static/img/icon_{{result['favicon']}}.png" alt="{{result['favicon']}}.png" title="{{result['favicon']}}.png" />
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
|
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
|
||||||
<a href="{{ result.url }}"><img width="300" height="170" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
|
<a href="{{ result.url }}"><img width="300" height="170" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
|
||||||
|
|
|
@ -141,11 +141,9 @@ def index():
|
||||||
result['pretty_url'] = result['url']
|
result['pretty_url'] = result['url']
|
||||||
|
|
||||||
for engine in result['engines']:
|
for engine in result['engines']:
|
||||||
if engine in ['wikipedia']:
|
if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter']:
|
||||||
result['favicon'] = engine
|
result['favicon'] = engine
|
||||||
featured_results.append(result)
|
if engine in ['wikipedia', 'ddg definitions']:
|
||||||
results.remove(result)
|
|
||||||
elif engine in ['ddg definitions']:
|
|
||||||
featured_results.append(result)
|
featured_results.append(result)
|
||||||
results.remove(result)
|
results.remove(result)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue