logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: 73ec2ba74ec735bb5e989cab0336ecca24a93701
parent 442772a6c5011f5dfd1e9d651d935b179cd14568
Author: Léo Bourrel <leo.bourrel@epitech.eu>
Date:   Wed, 19 Dec 2018 11:12:25 +0100

Update bing image engine with new image json format


Diffstat:

Msearx/engines/bing_images.py4+---
Mtests/unit/engines/test_bing_images.py6+++---
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py @@ -88,9 +88,7 @@ def response(resp): url = json_data.get('purl') img_src = json_data.get('murl') - - thumb_json_data = loads(_quote_keys_regex.sub(r'\1"\2": \3', link.attrib.get('mad'))) - thumbnail = thumb_json_data.get('turl') + thumbnail = json_data.get('turl') # append result results.append({'template': 'images.html', diff --git a/tests/unit/engines/test_bing_images.py b/tests/unit/engines/test_bing_images.py @@ -52,7 +52,7 @@ class TestBingImagesEngine(SearxTestCase): <li> <div> <div class="imgpt"> - <a m='{"purl":"page_url","murl":"img_url"}' mad='{"turl":"thumb_url"}'> + <a m='{"purl":"page_url","murl":"img_url","turl":"thumb_url"}'> <img src="" alt="alt text" /> </a> </div> @@ -60,7 +60,7 @@ class TestBingImagesEngine(SearxTestCase): </div> <div> <div class="imgpt"> - <a m='{"purl":"page_url2","murl":"img_url2"}' mad='{"turl":"thumb_url2"}'> + <a m='{"purl":"page_url2","murl":"img_url2","turl":"thumb_url2"}'> <img src="" alt="alt text 2" /> </a> </div> @@ -71,7 +71,7 @@ class TestBingImagesEngine(SearxTestCase): <li> <div> <div class="imgpt"> - <a m='{"purl":"page_url3","murl":"img_url3"}' mad='{"turl":"thumb_url3"}'> + <a m='{"purl":"page_url3","murl":"img_url3","turl":"thumb_url3"}'> <img src="" alt="alt text 3" /> </a> </div>