From 99efd790c8e24a9e7d1ab1220e1da96cdd0a8003 Mon Sep 17 00:00:00 2001
From: Alexandre Flament <alex@al-f.net>
Date: Sun, 26 Apr 2015 18:13:09 +0200
Subject: [PATCH 1/2] engines: use https when possible

---
 searx/engines/bing_images.py      | 2 +-
 searx/engines/currency_convert.py | 4 ++--
 searx/engines/deezer.py           | 4 ++--
 searx/engines/mixcloud.py         | 2 +-
 searx/engines/stackoverflow.py    | 2 +-
 searx/engines/vimeo.py            | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index b8c61c151..8569aa40d 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -26,7 +26,7 @@ safesearch = True
 # search-url
 base_url = 'https://www.bing.com/'
 search_string = 'images/search?{query}&count=10&first={offset}'
-thumb_url = "http://ts1.mm.bing.net/th?id={ihk}"
+thumb_url = "http://ts1.mm.bing.net/th?id={ihk}" # no https, bad certificate
 
 # safesearch definitions
 safesearch_types = {2: 'STRICT',
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py
index 4618c82b1..43334b0b9 100644
--- a/searx/engines/currency_convert.py
+++ b/searx/engines/currency_convert.py
@@ -2,7 +2,7 @@ from datetime import datetime
 import re
 
 categories = []
-url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
+url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
 weight = 100
 
 parser_re = re.compile(r'^\W*(\d+(?:\.\d+)?)\W*([a-z]{3})\W*(?:in)?\W*([a-z]{3})\W*$', re.I)  # noqa
@@ -44,7 +44,7 @@ def response(resp):
     )
 
     now_date = datetime.now().strftime('%Y%m%d')
-    url = 'http://finance.yahoo.com/currency/converter-results/{0}/{1}-{2}-to-{3}.html'  # noqa
+    url = 'https://finance.yahoo.com/currency/converter-results/{0}/{1}-{2}-to-{3}.html'  # noqa
     url = url.format(
         now_date,
         resp.search_params['ammount'],
diff --git a/searx/engines/deezer.py b/searx/engines/deezer.py
index 433ceffa1..8d0b46fac 100644
--- a/searx/engines/deezer.py
+++ b/searx/engines/deezer.py
@@ -16,11 +16,11 @@ categories = ['music']
 paging = True
 
 # search-url
-url = 'http://api.deezer.com/'
+url = 'https://api.deezer.com/'
 search_url = url + 'search?{query}&index={offset}'
 
 embedded_url = '<iframe scrolling="no" frameborder="0" allowTransparency="true" ' +\
-    'data-src="http://www.deezer.com/plugins/player?type=tracks&id={audioid}" ' +\
+    'data-src="https://www.deezer.com/plugins/player?type=tracks&id={audioid}" ' +\
     'width="540" height="80"></iframe>'
 
 
diff --git a/searx/engines/mixcloud.py b/searx/engines/mixcloud.py
index 676e6f845..918ae2908 100644
--- a/searx/engines/mixcloud.py
+++ b/searx/engines/mixcloud.py
@@ -17,7 +17,7 @@ categories = ['music']
 paging = True
 
 # search-url
-url = 'http://api.mixcloud.com/'
+url = 'https://api.mixcloud.com/'
 search_url = url + 'search/?{query}&type=cloudcast&limit=10&offset={offset}'
 
 embedded_url = '<iframe scrolling="no" frameborder="0" allowTransparency="true" ' +\
diff --git a/searx/engines/stackoverflow.py b/searx/engines/stackoverflow.py
index 78dba9f68..95ab58c54 100644
--- a/searx/engines/stackoverflow.py
+++ b/searx/engines/stackoverflow.py
@@ -19,7 +19,7 @@ categories = ['it']
 paging = True
 
 # search-url
-url = 'http://stackoverflow.com/'
+url = 'https://stackoverflow.com/'
 search_url = url+'search?{query}&page={pageno}'
 
 # specific xpath variables
diff --git a/searx/engines/vimeo.py b/searx/engines/vimeo.py
index 7577d12e1..0dcc65b7c 100644
--- a/searx/engines/vimeo.py
+++ b/searx/engines/vimeo.py
@@ -23,7 +23,7 @@ categories = ['videos']
 paging = True
 
 # search-url
-base_url = 'http://vimeo.com'
+base_url = 'https://vimeo.com'
 search_url = base_url + '/search/page:{pageno}?{query}'
 
 # specific xpath variables

From 043b269c6ee3157d7ab42fd394ed5a84185980cb Mon Sep 17 00:00:00 2001
From: Alexandre Flament <alex@al-f.net>
Date: Sun, 26 Apr 2015 19:23:06 +0200
Subject: [PATCH 2/2] [fix] tests

---
 searx/engines/bing_images.py                 | 2 +-
 searx/tests/engines/test_currency_convert.py | 2 +-
 searx/tests/engines/test_stackoverflow.py    | 2 +-
 searx/tests/engines/test_vimeo.py            | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index 8569aa40d..d4e3d2b2b 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -26,7 +26,7 @@ safesearch = True
 # search-url
 base_url = 'https://www.bing.com/'
 search_string = 'images/search?{query}&count=10&first={offset}'
-thumb_url = "http://ts1.mm.bing.net/th?id={ihk}" # no https, bad certificate
+thumb_url = "http://ts1.mm.bing.net/th?id={ihk}"  # no https, bad certificate
 
 # safesearch definitions
 safesearch_types = {2: 'STRICT',
diff --git a/searx/tests/engines/test_currency_convert.py b/searx/tests/engines/test_currency_convert.py
index 271ed03a2..579c5cc1f 100644
--- a/searx/tests/engines/test_currency_convert.py
+++ b/searx/tests/engines/test_currency_convert.py
@@ -40,5 +40,5 @@ class TestCurrencyConvertEngine(SearxTestCase):
         self.assertEqual(len(results), 1)
         self.assertEqual(results[0]['answer'], '10 EUR = 5.0 USD (1 EUR = 0.5 USD)')
         now_date = datetime.now().strftime('%Y%m%d')
-        self.assertEqual(results[0]['url'], 'http://finance.yahoo.com/currency/converter-results/' +
+        self.assertEqual(results[0]['url'], 'https://finance.yahoo.com/currency/converter-results/' +
                                             now_date + '/10-eur-to-usd.html')
diff --git a/searx/tests/engines/test_stackoverflow.py b/searx/tests/engines/test_stackoverflow.py
index e69bafb4c..18a1ff4bd 100644
--- a/searx/tests/engines/test_stackoverflow.py
+++ b/searx/tests/engines/test_stackoverflow.py
@@ -64,7 +64,7 @@ class TestStackoverflowEngine(SearxTestCase):
         self.assertEqual(type(results), list)
         self.assertEqual(len(results), 1)
         self.assertEqual(results[0]['title'], 'This is the title')
-        self.assertEqual(results[0]['url'], 'http://stackoverflow.com/questions/this.is.the.url')
+        self.assertEqual(results[0]['url'], 'https://stackoverflow.com/questions/this.is.the.url')
         self.assertEqual(results[0]['content'], 'This is the content')
 
         html = """
diff --git a/searx/tests/engines/test_vimeo.py b/searx/tests/engines/test_vimeo.py
index 24b3ad897..dad7239b4 100644
--- a/searx/tests/engines/test_vimeo.py
+++ b/searx/tests/engines/test_vimeo.py
@@ -52,7 +52,7 @@ class TestVimeoEngine(SearxTestCase):
         self.assertEqual(type(results), list)
         self.assertEqual(len(results), 1)
         self.assertEqual(results[0]['title'], 'This is the title')
-        self.assertEqual(results[0]['url'], 'http://vimeo.com/videoid')
+        self.assertEqual(results[0]['url'], 'https://vimeo.com/videoid')
         self.assertEqual(results[0]['content'], '')
         self.assertEqual(results[0]['thumbnail'], 'http://image.url.webp')
         self.assertIn('/videoid', results[0]['embedded'])