From aa85045a7d24ccc672c33a5f83ee92caa0386596 Mon Sep 17 00:00:00 2001 From: Pydo Date: Mon, 5 Sep 2016 14:50:26 -0400 Subject: [PATCH 01/23] Added seedpeer unitests --- tests/unit/engines/test_seedpeer.py | 159 ++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 tests/unit/engines/test_seedpeer.py diff --git a/tests/unit/engines/test_seedpeer.py b/tests/unit/engines/test_seedpeer.py new file mode 100644 index 000000000..379282d19 --- /dev/null +++ b/tests/unit/engines/test_seedpeer.py @@ -0,0 +1,159 @@ +import mock +from collections import defaultdict +from searx.engines import seedpeer +from searx.testing import SearxTestCase +from datetime import datetime + + +class TestSeedPeerEngine(SearxTestCase): + html = """ + + + + + + + +
+

Verified Narcos season 2 torrents

+ + comments | + verified + + Torrent nameAgeSizeSeedsPeersHealth
Narcos season 2 Full Version20 hours681.3 MB28 654 Health
Narcos season 2 Trusted Source12 hours787.1 MB64 220 Health
Full Narcos season 2 Download Usenet24 hours775.5 MB60 236 Health
Narcos season 2 2014 - DIRECT STREAMING Movies17 hours654.1 MB2 391 Health
Narcos season 2 2014 Movies20 hours754.5 MB21 919 Health


Search Binaries

 2 Narcos season 2 Torrents were found

+ + comments | + verified + + Torrent nameAgeSizeSeedsPeersHealth
Add to FacebookNarcos Season 2 Complete 720p WebRip EN-SUB x264-[MULVAcoded] S02 19 hours4.39 GB715 183 Health
Add to FacebookNarcos - Season 2 - 720p WEBRiP - x265 HEVC - ShAaNiG 1 day2.48 GB861 332 Health

Related searches for: Narcos season 2


Other suggested searches:

Search for "narcos-season-2" on Torrentz2.eu
Search for "narcos-season-2" on Torrent-Finder
  
+
+ + + """ + + def test_request(self): + query = 'test_query' + dicto = defaultdict(dict) + dicto['pageno'] = 1 + params = seedpeer.request(query, dicto) + self.assertIn('url', params) + self.assertIn(query, params['url']) + self.assertIn('seedpeer.eu', params['url']) + + def test_response_raises_attr_error_on_empty_response(self): + self.assertRaises(AttributeError, seedpeer.response, None) + self.assertRaises(AttributeError, seedpeer.response, []) + self.assertRaises(AttributeError, seedpeer.response, '') + self.assertRaises(AttributeError, seedpeer.response, '[]') + + def test_response_returns_empty_list(self): + response = mock.Mock(text='') + self.assertEqual(seedpeer.response(response), []) + + def test_response_returns_all_results(self): + response = mock.Mock(text=self.html) + results = seedpeer.response(response) + self.assertTrue(isinstance(results, list)) + self.assertEqual(len(results), 2) + + def test_response_returns_correct_results(self): + response = mock.Mock(text=self.html) + results = seedpeer.response(response) + self.assertEqual( + results[0]['title'], 'Narcos - Season 2 - 720p WEBRiP - x265 HEVC - ShAaNiG ' + ) + self.assertEqual( + results[0]['url'], + 'http://www.seedpeer.eu/details/11685972/Narcos---Season-2---720p-WEBRiP---x265-HEVC---ShAaNiG.html' + ) + self.assertEqual(results[0]['content'], '2.48 GB, 1 day') + self.assertEqual(results[0]['seed'], '861') + self.assertEqual(results[0]['leech'], '332') \ No newline at end of file From 2c2123b2e8f87178dadbf82b2cefbcef483c41a7 Mon Sep 17 00:00:00 2001 From: Pydo Date: Mon, 5 Sep 2016 14:51:02 -0400 Subject: [PATCH 02/23] Added seepeer to config and added seepeer search parser --- searx/engines/seedpeer.py | 78 +++++++++++++++++++++++++++++++++++++++ searx/settings.yml | 4 ++ 2 files changed, 82 insertions(+) create mode 100644 searx/engines/seedpeer.py diff --git a/searx/engines/seedpeer.py b/searx/engines/seedpeer.py new file mode 100644 index 000000000..854ebba03 --- /dev/null +++ b/searx/engines/seedpeer.py @@ -0,0 +1,78 @@ +# Seedpeer (Videos, Music, Files) +# +# @website http://seedpeer.eu +# @provide-api no (nothing found) +# +# @using-api no +# @results HTML (using search portal) +# @stable yes (HTML can change) +# @parse url, title, content, seed, leech, magnetlink + +from urlparse import urljoin +from cgi import escape +from urllib import quote +from lxml import html +from operator import itemgetter +from searx.engines.xpath import extract_text + + +url = 'http://www.seedpeer.eu/' +search_url = url + 'search/{search_term}/7/{page_no}.html' +# specific xpath variables +torrent_xpath = '//*[@id="body"]/center/center/table[2]/tr/td/a' +alternative_torrent_xpath = '//*[@id="body"]/center/center/table[1]/tr/td/a' +title_xpath = '//*[@id="body"]/center/center/table[2]/tr/td/a/text()' +alternative_title_xpath = '//*[@id="body"]/center/center/table/tr/td/a' +seeds_xpath = '//*[@id="body"]/center/center/table[2]/tr/td[4]/font/text()' +alternative_seeds_xpath = '//*[@id="body"]/center/center/table/tr/td[4]/font/text()' +peers_xpath = '//*[@id="body"]/center/center/table[2]/tr/td[5]/font/text()' +alternative_peers_xpath = '//*[@id="body"]/center/center/table/tr/td[5]/font/text()' +age_xpath = '//*[@id="body"]/center/center/table[2]/tr/td[2]/text()' +alternative_age_xpath = '//*[@id="body"]/center/center/table/tr/td[2]/text()' +size_xpath = '//*[@id="body"]/center/center/table[2]/tr/td[3]/text()' +alternative_size_xpath = '//*[@id="body"]/center/center/table/tr/td[3]/text()' + + +# do search-request +def request(query, params): + params['url'] = search_url.format(search_term=quote(query), + page_no=params['pageno'] - 1) + return params + + +# get response from search-request +def response(resp): + results = [] + dom = html.fromstring(resp.text) + torrent_links = dom.xpath(torrent_xpath) + if len(torrent_links) > 0: + seeds = dom.xpath(seeds_xpath) + peers = dom.xpath(peers_xpath) + titles = dom.xpath(title_xpath) + sizes = dom.xpath(size_xpath) + ages = dom.xpath(age_xpath) + else: # under ~5 results uses a different xpath + torrent_links = dom.xpath(alternative_torrent_xpath) + seeds = dom.xpath(alternative_seeds_xpath) + peers = dom.xpath(alternative_peers_xpath) + titles = dom.xpath(alternative_title_xpath) + sizes = dom.xpath(alternative_size_xpath) + ages = dom.xpath(alternative_age_xpath) + # return empty array if nothing is found + if not torrent_links: + return [] + + # parse results + for index, result in enumerate(torrent_links): + link = result.attrib.get('href') + href = urljoin(url, link) + results.append({'url': href, + 'title': titles[index].text_content(), + 'content': '{}, {}'.format(sizes[index], ages[index]), + 'seed': seeds[index], + 'leech': peers[index], + + 'template': 'torrent.html'}) + + # return results sorted by seeder + return sorted(results, key=itemgetter('seed'), reverse=True) diff --git a/searx/settings.yml b/searx/settings.yml index 2c034a863..570ad1f84 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -495,6 +495,10 @@ engines: timeout: 6.0 categories : science + - name : seedpeer + engine : seedpeer + shortcut: speu + #The blekko technology and team have joined IBM Watson! -> https://blekko.com/ # - name : blekko images # engine : blekko_images From ec4a03628edfed2ceb192a323a47b2bc6271bdcc Mon Sep 17 00:00:00 2001 From: Pydo Date: Mon, 5 Sep 2016 15:37:20 -0400 Subject: [PATCH 03/23] Put html fixture in file to be pep8 line length compliant --- tests/unit/engines/seedpeer_fixture.html | 110 +++++++++++++++++++++ tests/unit/engines/test_seedpeer.py | 116 +---------------------- 2 files changed, 114 insertions(+), 112 deletions(-) create mode 100644 tests/unit/engines/seedpeer_fixture.html diff --git a/tests/unit/engines/seedpeer_fixture.html b/tests/unit/engines/seedpeer_fixture.html new file mode 100644 index 000000000..28207bfad --- /dev/null +++ b/tests/unit/engines/seedpeer_fixture.html @@ -0,0 +1,110 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tests/unit/engines/test_seedpeer.py b/tests/unit/engines/test_seedpeer.py index 379282d19..37b2de8e4 100644 --- a/tests/unit/engines/test_seedpeer.py +++ b/tests/unit/engines/test_seedpeer.py @@ -6,118 +6,10 @@ from datetime import datetime class TestSeedPeerEngine(SearxTestCase): - html = """ - - - - - - - - - - - """ + html = '' + with open('./tests/unit/engines/seedpeer_fixture.html') as fixture: + html += fixture.read() def test_request(self): query = 'test_query' @@ -156,4 +48,4 @@ class TestSeedPeerEngine(SearxTestCase): ) self.assertEqual(results[0]['content'], '2.48 GB, 1 day') self.assertEqual(results[0]['seed'], '861') - self.assertEqual(results[0]['leech'], '332') \ No newline at end of file + self.assertEqual(results[0]['leech'], '332') From d1d4ed4376e41fa380b5b3a72e1b08e1f36a35e8 Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 20 Sep 2016 15:35:54 -0500 Subject: [PATCH 04/23] [fix] results with digbit don't truncate anymore --- searx/engines/digbt.py | 2 +- tests/unit/engines/test_digbt.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/searx/engines/digbt.py b/searx/engines/digbt.py index c35327e8c..b55d7747a 100644 --- a/searx/engines/digbt.py +++ b/searx/engines/digbt.py @@ -40,7 +40,7 @@ def response(resp): results = list() for result in search_res: url = urljoin(URL, result.xpath('.//a[@title]/@href')[0]) - title = result.xpath('.//a[@title]/text()')[0] + title = extract_text(result.xpath('.//a[@title]')) content = extract_text(result.xpath('.//div[@class="files"]')) files_data = extract_text(result.xpath('.//div[@class="tail"]')).split() filesize = get_torrent_size(files_data[FILESIZE], files_data[FILESIZE_MULTIPLIER]) diff --git a/tests/unit/engines/test_digbt.py b/tests/unit/engines/test_digbt.py index 867188ed9..31a1b03a4 100644 --- a/tests/unit/engines/test_digbt.py +++ b/tests/unit/engines/test_digbt.py @@ -28,7 +28,9 @@ class TestDigBTEngine(SearxTestCase):
From bee7b497a300622f5ba2b619817f5c89c29ae871 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Thu, 22 Sep 2016 23:51:07 +0200 Subject: [PATCH 05/23] [mod] rename "default" theme to "legacy" --- manage.sh | 4 ++-- searx/settings_robot.yml | 2 +- .../themes/{default => legacy}/css/style-rtl.css | 0 .../static/themes/{default => legacy}/css/style.css | 0 .../themes/{default => legacy}/img/favicon.png | Bin .../{default => legacy}/img/github_ribbon.png | Bin .../{default => legacy}/img/icons/icon_500px.ico | Bin .../{default => legacy}/img/icons/icon_bing.ico | Bin .../img/icons/icon_dailymotion.ico | Bin .../{default => legacy}/img/icons/icon_deezer.ico | Bin .../img/icons/icon_deviantart.ico | Bin .../{default => legacy}/img/icons/icon_digg.ico | Bin .../img/icons/icon_duckduckgo.ico | Bin .../{default => legacy}/img/icons/icon_flickr.ico | Bin .../{default => legacy}/img/icons/icon_github.ico | Bin .../img/icons/icon_google play apps.ico | Bin .../img/icons/icon_google play movies.ico | Bin .../img/icons/icon_google play music.ico | Bin .../{default => legacy}/img/icons/icon_google.ico | Bin .../{default => legacy}/img/icons/icon_kickass.ico | Bin .../img/icons/icon_openstreetmap.ico | Bin .../img/icons/icon_searchcode code.ico | Bin .../img/icons/icon_searchcode doc.ico | Bin .../img/icons/icon_searchcode.ico | Bin .../img/icons/icon_soundcloud.ico | Bin .../img/icons/icon_stackoverflow.ico | Bin .../img/icons/icon_startpage.ico | Bin .../img/icons/icon_subtitleseeker.ico | Bin .../{default => legacy}/img/icons/icon_twitter.ico | Bin .../{default => legacy}/img/icons/icon_vimeo.ico | Bin .../img/icons/icon_wikipedia.ico | Bin .../{default => legacy}/img/icons/icon_yahoo.ico | Bin .../{default => legacy}/img/icons/icon_youtube.ico | Bin .../{default => legacy}/img/preference-icon.png | Bin .../themes/{default => legacy}/img/search-icon.png | Bin .../static/themes/{default => legacy}/img/searx.png | Bin .../themes/{default => legacy}/img/searx_logo.svg | 0 searx/static/themes/{default => legacy}/js/searx.js | 0 .../{default => legacy}/less/autocompleter.less | 0 .../themes/{default => legacy}/less/code.less | 0 .../{default => legacy}/less/definitions.less | 0 .../themes/{default => legacy}/less/mixins.less | 0 .../themes/{default => legacy}/less/search.less | 0 .../themes/{default => legacy}/less/style-rtl.less | 0 .../themes/{default => legacy}/less/style.less | 0 searx/templates/{default => legacy}/404.html | 2 +- searx/templates/{default => legacy}/about.html | 4 ++-- searx/templates/{default => legacy}/base.html | 0 searx/templates/{default => legacy}/categories.html | 0 .../{default => legacy}/github_ribbon.html | 0 searx/templates/{default => legacy}/index.html | 6 +++--- searx/templates/{default => legacy}/infobox.html | 0 searx/templates/{default => legacy}/opensearch.xml | 0 .../{default => legacy}/opensearch_response_rss.xml | 0 .../templates/{default => legacy}/preferences.html | 4 ++-- .../{default => legacy}/result_templates/code.html | 0 .../result_templates/default.html | 0 .../result_templates/images.html | 0 .../{default => legacy}/result_templates/map.html | 0 .../result_templates/torrent.html | 0 .../result_templates/videos.html | 0 searx/templates/{default => legacy}/results.html | 10 +++++----- searx/templates/{default => legacy}/search.html | 2 +- searx/templates/{default => legacy}/stats.html | 2 +- searx/templates/pix-art/preferences.html | 2 +- searx/templates/pix-art/stats.html | 2 +- tests/robot/test_basic.robot | 4 ++-- tests/unit/test_webapp.py | 4 ++-- 68 files changed, 24 insertions(+), 24 deletions(-) rename searx/static/themes/{default => legacy}/css/style-rtl.css (100%) rename searx/static/themes/{default => legacy}/css/style.css (100%) rename searx/static/themes/{default => legacy}/img/favicon.png (100%) rename searx/static/themes/{default => legacy}/img/github_ribbon.png (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_500px.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_bing.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_dailymotion.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_deezer.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_deviantart.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_digg.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_duckduckgo.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_flickr.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_github.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_google play apps.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_google play movies.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_google play music.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_google.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_kickass.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_openstreetmap.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_searchcode code.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_searchcode doc.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_searchcode.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_soundcloud.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_stackoverflow.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_startpage.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_subtitleseeker.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_twitter.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_vimeo.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_wikipedia.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_yahoo.ico (100%) rename searx/static/themes/{default => legacy}/img/icons/icon_youtube.ico (100%) rename searx/static/themes/{default => legacy}/img/preference-icon.png (100%) rename searx/static/themes/{default => legacy}/img/search-icon.png (100%) rename searx/static/themes/{default => legacy}/img/searx.png (100%) rename searx/static/themes/{default => legacy}/img/searx_logo.svg (100%) rename searx/static/themes/{default => legacy}/js/searx.js (100%) rename searx/static/themes/{default => legacy}/less/autocompleter.less (100%) rename searx/static/themes/{default => legacy}/less/code.less (100%) rename searx/static/themes/{default => legacy}/less/definitions.less (100%) rename searx/static/themes/{default => legacy}/less/mixins.less (100%) rename searx/static/themes/{default => legacy}/less/search.less (100%) rename searx/static/themes/{default => legacy}/less/style-rtl.less (100%) rename searx/static/themes/{default => legacy}/less/style.less (100%) rename searx/templates/{default => legacy}/404.html (89%) rename searx/templates/{default => legacy}/about.html (97%) rename searx/templates/{default => legacy}/base.html (100%) rename searx/templates/{default => legacy}/categories.html (100%) rename searx/templates/{default => legacy}/github_ribbon.html (100%) rename searx/templates/{default => legacy}/index.html (80%) rename searx/templates/{default => legacy}/infobox.html (100%) rename searx/templates/{default => legacy}/opensearch.xml (100%) rename searx/templates/{default => legacy}/opensearch_response_rss.xml (100%) rename searx/templates/{default => legacy}/preferences.html (98%) rename searx/templates/{default => legacy}/result_templates/code.html (100%) rename searx/templates/{default => legacy}/result_templates/default.html (100%) rename searx/templates/{default => legacy}/result_templates/images.html (100%) rename searx/templates/{default => legacy}/result_templates/map.html (100%) rename searx/templates/{default => legacy}/result_templates/torrent.html (100%) rename searx/templates/{default => legacy}/result_templates/videos.html (100%) rename searx/templates/{default => legacy}/results.html (93%) rename searx/templates/{default => legacy}/search.html (90%) rename searx/templates/{default => legacy}/stats.html (94%) diff --git a/manage.sh b/manage.sh index 75ba32024..11f2df04d 100755 --- a/manage.sh +++ b/manage.sh @@ -53,8 +53,8 @@ build_style() { styles() { echo '[!] Building styles' - build_style themes/default/less/style.less themes/default/css/style.css - build_style themes/default/less/style-rtl.less themes/default/css/style-rtl.css + build_style themes/legacy/less/style.less themes/legacy/css/style.css + build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css build_style themes/courgette/less/style.less themes/courgette/css/style.css build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css build_style less/bootstrap/bootstrap.less css/bootstrap.min.css diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index 7c7c4eec2..1ae084155 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -15,7 +15,7 @@ server: ui: themes_path : "" - default_theme : default + default_theme : legacy default_locale : "" outgoing: diff --git a/searx/static/themes/default/css/style-rtl.css b/searx/static/themes/legacy/css/style-rtl.css similarity index 100% rename from searx/static/themes/default/css/style-rtl.css rename to searx/static/themes/legacy/css/style-rtl.css diff --git a/searx/static/themes/default/css/style.css b/searx/static/themes/legacy/css/style.css similarity index 100% rename from searx/static/themes/default/css/style.css rename to searx/static/themes/legacy/css/style.css diff --git a/searx/static/themes/default/img/favicon.png b/searx/static/themes/legacy/img/favicon.png similarity index 100% rename from searx/static/themes/default/img/favicon.png rename to searx/static/themes/legacy/img/favicon.png diff --git a/searx/static/themes/default/img/github_ribbon.png b/searx/static/themes/legacy/img/github_ribbon.png similarity index 100% rename from searx/static/themes/default/img/github_ribbon.png rename to searx/static/themes/legacy/img/github_ribbon.png diff --git a/searx/static/themes/default/img/icons/icon_500px.ico b/searx/static/themes/legacy/img/icons/icon_500px.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_500px.ico rename to searx/static/themes/legacy/img/icons/icon_500px.ico diff --git a/searx/static/themes/default/img/icons/icon_bing.ico b/searx/static/themes/legacy/img/icons/icon_bing.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_bing.ico rename to searx/static/themes/legacy/img/icons/icon_bing.ico diff --git a/searx/static/themes/default/img/icons/icon_dailymotion.ico b/searx/static/themes/legacy/img/icons/icon_dailymotion.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_dailymotion.ico rename to searx/static/themes/legacy/img/icons/icon_dailymotion.ico diff --git a/searx/static/themes/default/img/icons/icon_deezer.ico b/searx/static/themes/legacy/img/icons/icon_deezer.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_deezer.ico rename to searx/static/themes/legacy/img/icons/icon_deezer.ico diff --git a/searx/static/themes/default/img/icons/icon_deviantart.ico b/searx/static/themes/legacy/img/icons/icon_deviantart.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_deviantart.ico rename to searx/static/themes/legacy/img/icons/icon_deviantart.ico diff --git a/searx/static/themes/default/img/icons/icon_digg.ico b/searx/static/themes/legacy/img/icons/icon_digg.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_digg.ico rename to searx/static/themes/legacy/img/icons/icon_digg.ico diff --git a/searx/static/themes/default/img/icons/icon_duckduckgo.ico b/searx/static/themes/legacy/img/icons/icon_duckduckgo.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_duckduckgo.ico rename to searx/static/themes/legacy/img/icons/icon_duckduckgo.ico diff --git a/searx/static/themes/default/img/icons/icon_flickr.ico b/searx/static/themes/legacy/img/icons/icon_flickr.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_flickr.ico rename to searx/static/themes/legacy/img/icons/icon_flickr.ico diff --git a/searx/static/themes/default/img/icons/icon_github.ico b/searx/static/themes/legacy/img/icons/icon_github.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_github.ico rename to searx/static/themes/legacy/img/icons/icon_github.ico diff --git a/searx/static/themes/default/img/icons/icon_google play apps.ico b/searx/static/themes/legacy/img/icons/icon_google play apps.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_google play apps.ico rename to searx/static/themes/legacy/img/icons/icon_google play apps.ico diff --git a/searx/static/themes/default/img/icons/icon_google play movies.ico b/searx/static/themes/legacy/img/icons/icon_google play movies.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_google play movies.ico rename to searx/static/themes/legacy/img/icons/icon_google play movies.ico diff --git a/searx/static/themes/default/img/icons/icon_google play music.ico b/searx/static/themes/legacy/img/icons/icon_google play music.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_google play music.ico rename to searx/static/themes/legacy/img/icons/icon_google play music.ico diff --git a/searx/static/themes/default/img/icons/icon_google.ico b/searx/static/themes/legacy/img/icons/icon_google.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_google.ico rename to searx/static/themes/legacy/img/icons/icon_google.ico diff --git a/searx/static/themes/default/img/icons/icon_kickass.ico b/searx/static/themes/legacy/img/icons/icon_kickass.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_kickass.ico rename to searx/static/themes/legacy/img/icons/icon_kickass.ico diff --git a/searx/static/themes/default/img/icons/icon_openstreetmap.ico b/searx/static/themes/legacy/img/icons/icon_openstreetmap.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_openstreetmap.ico rename to searx/static/themes/legacy/img/icons/icon_openstreetmap.ico diff --git a/searx/static/themes/default/img/icons/icon_searchcode code.ico b/searx/static/themes/legacy/img/icons/icon_searchcode code.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_searchcode code.ico rename to searx/static/themes/legacy/img/icons/icon_searchcode code.ico diff --git a/searx/static/themes/default/img/icons/icon_searchcode doc.ico b/searx/static/themes/legacy/img/icons/icon_searchcode doc.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_searchcode doc.ico rename to searx/static/themes/legacy/img/icons/icon_searchcode doc.ico diff --git a/searx/static/themes/default/img/icons/icon_searchcode.ico b/searx/static/themes/legacy/img/icons/icon_searchcode.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_searchcode.ico rename to searx/static/themes/legacy/img/icons/icon_searchcode.ico diff --git a/searx/static/themes/default/img/icons/icon_soundcloud.ico b/searx/static/themes/legacy/img/icons/icon_soundcloud.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_soundcloud.ico rename to searx/static/themes/legacy/img/icons/icon_soundcloud.ico diff --git a/searx/static/themes/default/img/icons/icon_stackoverflow.ico b/searx/static/themes/legacy/img/icons/icon_stackoverflow.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_stackoverflow.ico rename to searx/static/themes/legacy/img/icons/icon_stackoverflow.ico diff --git a/searx/static/themes/default/img/icons/icon_startpage.ico b/searx/static/themes/legacy/img/icons/icon_startpage.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_startpage.ico rename to searx/static/themes/legacy/img/icons/icon_startpage.ico diff --git a/searx/static/themes/default/img/icons/icon_subtitleseeker.ico b/searx/static/themes/legacy/img/icons/icon_subtitleseeker.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_subtitleseeker.ico rename to searx/static/themes/legacy/img/icons/icon_subtitleseeker.ico diff --git a/searx/static/themes/default/img/icons/icon_twitter.ico b/searx/static/themes/legacy/img/icons/icon_twitter.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_twitter.ico rename to searx/static/themes/legacy/img/icons/icon_twitter.ico diff --git a/searx/static/themes/default/img/icons/icon_vimeo.ico b/searx/static/themes/legacy/img/icons/icon_vimeo.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_vimeo.ico rename to searx/static/themes/legacy/img/icons/icon_vimeo.ico diff --git a/searx/static/themes/default/img/icons/icon_wikipedia.ico b/searx/static/themes/legacy/img/icons/icon_wikipedia.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_wikipedia.ico rename to searx/static/themes/legacy/img/icons/icon_wikipedia.ico diff --git a/searx/static/themes/default/img/icons/icon_yahoo.ico b/searx/static/themes/legacy/img/icons/icon_yahoo.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_yahoo.ico rename to searx/static/themes/legacy/img/icons/icon_yahoo.ico diff --git a/searx/static/themes/default/img/icons/icon_youtube.ico b/searx/static/themes/legacy/img/icons/icon_youtube.ico similarity index 100% rename from searx/static/themes/default/img/icons/icon_youtube.ico rename to searx/static/themes/legacy/img/icons/icon_youtube.ico diff --git a/searx/static/themes/default/img/preference-icon.png b/searx/static/themes/legacy/img/preference-icon.png similarity index 100% rename from searx/static/themes/default/img/preference-icon.png rename to searx/static/themes/legacy/img/preference-icon.png diff --git a/searx/static/themes/default/img/search-icon.png b/searx/static/themes/legacy/img/search-icon.png similarity index 100% rename from searx/static/themes/default/img/search-icon.png rename to searx/static/themes/legacy/img/search-icon.png diff --git a/searx/static/themes/default/img/searx.png b/searx/static/themes/legacy/img/searx.png similarity index 100% rename from searx/static/themes/default/img/searx.png rename to searx/static/themes/legacy/img/searx.png diff --git a/searx/static/themes/default/img/searx_logo.svg b/searx/static/themes/legacy/img/searx_logo.svg similarity index 100% rename from searx/static/themes/default/img/searx_logo.svg rename to searx/static/themes/legacy/img/searx_logo.svg diff --git a/searx/static/themes/default/js/searx.js b/searx/static/themes/legacy/js/searx.js similarity index 100% rename from searx/static/themes/default/js/searx.js rename to searx/static/themes/legacy/js/searx.js diff --git a/searx/static/themes/default/less/autocompleter.less b/searx/static/themes/legacy/less/autocompleter.less similarity index 100% rename from searx/static/themes/default/less/autocompleter.less rename to searx/static/themes/legacy/less/autocompleter.less diff --git a/searx/static/themes/default/less/code.less b/searx/static/themes/legacy/less/code.less similarity index 100% rename from searx/static/themes/default/less/code.less rename to searx/static/themes/legacy/less/code.less diff --git a/searx/static/themes/default/less/definitions.less b/searx/static/themes/legacy/less/definitions.less similarity index 100% rename from searx/static/themes/default/less/definitions.less rename to searx/static/themes/legacy/less/definitions.less diff --git a/searx/static/themes/default/less/mixins.less b/searx/static/themes/legacy/less/mixins.less similarity index 100% rename from searx/static/themes/default/less/mixins.less rename to searx/static/themes/legacy/less/mixins.less diff --git a/searx/static/themes/default/less/search.less b/searx/static/themes/legacy/less/search.less similarity index 100% rename from searx/static/themes/default/less/search.less rename to searx/static/themes/legacy/less/search.less diff --git a/searx/static/themes/default/less/style-rtl.less b/searx/static/themes/legacy/less/style-rtl.less similarity index 100% rename from searx/static/themes/default/less/style-rtl.less rename to searx/static/themes/legacy/less/style-rtl.less diff --git a/searx/static/themes/default/less/style.less b/searx/static/themes/legacy/less/style.less similarity index 100% rename from searx/static/themes/default/less/style.less rename to searx/static/themes/legacy/less/style.less diff --git a/searx/templates/default/404.html b/searx/templates/legacy/404.html similarity index 89% rename from searx/templates/default/404.html rename to searx/templates/legacy/404.html index 1d88f86c4..05c14e155 100644 --- a/searx/templates/default/404.html +++ b/searx/templates/legacy/404.html @@ -1,4 +1,4 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block content %}

{{ _('Page not found') }}

diff --git a/searx/templates/default/about.html b/searx/templates/legacy/about.html similarity index 97% rename from searx/templates/default/about.html rename to searx/templates/legacy/about.html index f21a6f296..45fb0e449 100644 --- a/searx/templates/default/about.html +++ b/searx/templates/legacy/about.html @@ -1,6 +1,6 @@ -{% extends 'default/base.html' %} +{% extends 'legacy/base.html' %} {% block content %} -{% include 'default/github_ribbon.html' %} +{% include 'legacy/github_ribbon.html' %}

About searx

diff --git a/searx/templates/default/base.html b/searx/templates/legacy/base.html similarity index 100% rename from searx/templates/default/base.html rename to searx/templates/legacy/base.html diff --git a/searx/templates/default/categories.html b/searx/templates/legacy/categories.html similarity index 100% rename from searx/templates/default/categories.html rename to searx/templates/legacy/categories.html diff --git a/searx/templates/default/github_ribbon.html b/searx/templates/legacy/github_ribbon.html similarity index 100% rename from searx/templates/default/github_ribbon.html rename to searx/templates/legacy/github_ribbon.html diff --git a/searx/templates/default/index.html b/searx/templates/legacy/index.html similarity index 80% rename from searx/templates/default/index.html rename to searx/templates/legacy/index.html index fc15a44b6..de956d5b3 100644 --- a/searx/templates/default/index.html +++ b/searx/templates/legacy/index.html @@ -1,8 +1,8 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block content %}

searx

- {% include 'default/search.html' %} + {% include 'legacy/search.html' %}

{% if rtl %} {{ _('preferences') }} @@ -13,6 +13,6 @@ {% endif %}

-{% include 'default/github_ribbon.html' %} +{% include 'legacy/github_ribbon.html' %} {% endblock %} diff --git a/searx/templates/default/infobox.html b/searx/templates/legacy/infobox.html similarity index 100% rename from searx/templates/default/infobox.html rename to searx/templates/legacy/infobox.html diff --git a/searx/templates/default/opensearch.xml b/searx/templates/legacy/opensearch.xml similarity index 100% rename from searx/templates/default/opensearch.xml rename to searx/templates/legacy/opensearch.xml diff --git a/searx/templates/default/opensearch_response_rss.xml b/searx/templates/legacy/opensearch_response_rss.xml similarity index 100% rename from searx/templates/default/opensearch_response_rss.xml rename to searx/templates/legacy/opensearch_response_rss.xml diff --git a/searx/templates/default/preferences.html b/searx/templates/legacy/preferences.html similarity index 98% rename from searx/templates/default/preferences.html rename to searx/templates/legacy/preferences.html index 1de9d2275..30d632c93 100644 --- a/searx/templates/default/preferences.html +++ b/searx/templates/legacy/preferences.html @@ -1,4 +1,4 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block head %} {% endblock %} {% block content %}
@@ -8,7 +8,7 @@
{{ _('Default categories') }} {% set display_tooltip = false %} - {% include 'default/categories.html' %} + {% include 'legacy/categories.html' %}
{{ _('Search language') }} diff --git a/searx/templates/default/result_templates/code.html b/searx/templates/legacy/result_templates/code.html similarity index 100% rename from searx/templates/default/result_templates/code.html rename to searx/templates/legacy/result_templates/code.html diff --git a/searx/templates/default/result_templates/default.html b/searx/templates/legacy/result_templates/default.html similarity index 100% rename from searx/templates/default/result_templates/default.html rename to searx/templates/legacy/result_templates/default.html diff --git a/searx/templates/default/result_templates/images.html b/searx/templates/legacy/result_templates/images.html similarity index 100% rename from searx/templates/default/result_templates/images.html rename to searx/templates/legacy/result_templates/images.html diff --git a/searx/templates/default/result_templates/map.html b/searx/templates/legacy/result_templates/map.html similarity index 100% rename from searx/templates/default/result_templates/map.html rename to searx/templates/legacy/result_templates/map.html diff --git a/searx/templates/default/result_templates/torrent.html b/searx/templates/legacy/result_templates/torrent.html similarity index 100% rename from searx/templates/default/result_templates/torrent.html rename to searx/templates/legacy/result_templates/torrent.html diff --git a/searx/templates/default/result_templates/videos.html b/searx/templates/legacy/result_templates/videos.html similarity index 100% rename from searx/templates/default/result_templates/videos.html rename to searx/templates/legacy/result_templates/videos.html diff --git a/searx/templates/default/results.html b/searx/templates/legacy/results.html similarity index 93% rename from searx/templates/default/results.html rename to searx/templates/legacy/results.html index 927b7b8a8..f50700c6f 100644 --- a/searx/templates/default/results.html +++ b/searx/templates/legacy/results.html @@ -1,10 +1,10 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block title %}{{ q }} - {% endblock %} {% block meta %}{% endblock %} {% block content %}
{% set display_tooltip = true %} - {% include 'default/categories.html' %} + {% include 'legacy/categories.html' %} diff --git a/searx/templates/default/stats.html b/searx/templates/legacy/stats.html similarity index 94% rename from searx/templates/default/stats.html rename to searx/templates/legacy/stats.html index 70fe98ac7..372447e23 100644 --- a/searx/templates/default/stats.html +++ b/searx/templates/legacy/stats.html @@ -1,4 +1,4 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block head %} {% endblock %} {% block content %}

{{ _('Engine stats') }}

diff --git a/searx/templates/pix-art/preferences.html b/searx/templates/pix-art/preferences.html index a4a6cd268..ea5557b07 100644 --- a/searx/templates/pix-art/preferences.html +++ b/searx/templates/pix-art/preferences.html @@ -1,4 +1,4 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block head %} {% endblock %} {% block content %}
diff --git a/searx/templates/pix-art/stats.html b/searx/templates/pix-art/stats.html index 70fe98ac7..372447e23 100644 --- a/searx/templates/pix-art/stats.html +++ b/searx/templates/pix-art/stats.html @@ -1,4 +1,4 @@ -{% extends "default/base.html" %} +{% extends "legacy/base.html" %} {% block head %} {% endblock %} {% block content %}

{{ _('Engine stats') }}

diff --git a/tests/robot/test_basic.robot b/tests/robot/test_basic.robot index a455eeaa0..540060fef 100644 --- a/tests/robot/test_basic.robot +++ b/tests/robot/test_basic.robot @@ -67,7 +67,7 @@ Change theme Page Should Contain about Page Should Contain preferences Go To http://localhost:11111/preferences - List Selection Should Be theme default + List Selection Should Be theme legacy Select From List theme oscar Submit Form id=search_form Location Should Be http://localhost:11111/ @@ -139,7 +139,7 @@ Block a plugin Page Should Contain about Page Should Contain preferences Go To http://localhost:11111/preferences - List Selection Should Be theme default + List Selection Should Be theme legacy Select From List theme oscar Submit Form id=search_form Location Should Be http://localhost:11111/ diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 1762d66b6..912bebc4d 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -44,7 +44,7 @@ class ViewsTestCase(SearxTestCase): webapp.Search.search = search_mock def get_current_theme_name_mock(override=None): - return 'default' + return 'legacy' webapp.get_current_theme_name = get_current_theme_name_mock @@ -58,7 +58,7 @@ class ViewsTestCase(SearxTestCase): def test_index_html(self): result = self.app.post('/', data={'q': 'test'}) self.assertIn( - '

youtubeSecond Test

', # noqa + '

youtubeSecond Test

', # noqa result.data ) self.assertIn( From 86daef2063a83a6aee90e9f269644e0803ae9cb9 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 28 Sep 2016 22:30:05 +0200 Subject: [PATCH 06/23] [fix] do not allow underscore in engine names - closes #708 --- searx/engines/__init__.py | 12 +++++++++--- searx/settings.yml | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 782b622b0..14376c31f 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -57,11 +57,17 @@ def load_module(filename): def load_engine(engine_data): - engine_name = engine_data['engine'] + + if '_' in engine_data['name']: + logger.error('Engine name conains underscore: "{}"'.format(engine_data['name'])) + sys.exit(1) + + engine_module = engine_data['engine'] + try: - engine = load_module(engine_name + '.py') + engine = load_module(engine_module + '.py') except: - logger.exception('Cannot load engine "{}"'.format(engine_name)) + logger.exception('Cannot load engine "{}"'.format(engine_module)) return None for param_name in engine_data: diff --git a/searx/settings.yml b/searx/settings.yml index 308a0bd45..72bc7ed0f 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -377,7 +377,7 @@ engines: timeout : 10.0 disabled : True - - name : scanr_structures + - name : scanr structures shortcut: scs engine : scanr_structures disabled : True From 812ade82b17fe1eec48b3ca6c57f2d4de104209f Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 28 Sep 2016 22:49:29 +0200 Subject: [PATCH 07/23] [fix] robot test engine names --- searx/settings_robot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index 1ae084155..43dc9b00a 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -23,12 +23,12 @@ outgoing: useragent_suffix : "" engines: - - name : general_dummy + - name : general dummy engine : dummy categories : general shortcut : gd - - name : dummy_dummy + - name : dummy dummy engine : dummy categories : dummy shortcut : dd From 295fc9ce96d8cca9c6c4776a00e5fb0942eb6f4d Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 28 Sep 2016 22:59:13 +0200 Subject: [PATCH 08/23] [fix] robot test engine names II. --- tests/robot/test_basic.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/robot/test_basic.robot b/tests/robot/test_basic.robot index 540060fef..ab41265a0 100644 --- a/tests/robot/test_basic.robot +++ b/tests/robot/test_basic.robot @@ -24,8 +24,8 @@ Preferences page Page Should Contain Preferences Page Should Contain Default categories Page Should Contain Currently used search engines - Page Should Contain dummy_dummy - Page Should Contain general_dummy + Page Should Contain dummy dummy + Page Should Contain general dummy Switch category Go To http://localhost:11111/preferences From 6f87bf2a1c76f1b94ad2119df7fb938c2307e370 Mon Sep 17 00:00:00 2001 From: Pydo Date: Sat, 1 Oct 2016 10:28:01 -0400 Subject: [PATCH 09/23] Disabled seepeer.eu by default since it does not support https --- searx/settings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/searx/settings.yml b/searx/settings.yml index 570ad1f84..b13a38336 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -498,6 +498,7 @@ engines: - name : seedpeer engine : seedpeer shortcut: speu + disabled: True #The blekko technology and team have joined IBM Watson! -> https://blekko.com/ # - name : blekko images From ccd1d9389139d5f459a1496e6e26c92e43ffc7c1 Mon Sep 17 00:00:00 2001 From: Pydo Date: Sat, 1 Oct 2016 11:04:14 -0400 Subject: [PATCH 10/23] Add pydo to authors --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 505b28eeb..f7864887a 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -58,3 +58,4 @@ generally made searx better: - marc @a01200356 - Harry Wood @harry-wood - Thomas Renard @threnard +- Pydo ``_ From dceb9031140a12972d000849ea8819a6d383739a Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Sat, 1 Oct 2016 20:22:52 +0200 Subject: [PATCH 11/23] [mod] disallow search results for robots --- searx/webapp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/searx/webapp.py b/searx/webapp.py index 262bf9bdf..5bdbc71a6 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -657,6 +657,7 @@ Allow: / Allow: /about Disallow: /stats Disallow: /preferences +Disallow: /*?*q=* """, mimetype='text/plain') From 01844b6f04c99a7a5219ec06afe4266c76a57aeb Mon Sep 17 00:00:00 2001 From: Pydo Date: Sat, 1 Oct 2016 19:22:36 -0400 Subject: [PATCH 12/23] Set default categories for seedpeer provider --- searx/settings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/searx/settings.yml b/searx/settings.yml index 2846b2a0d..f6848a24e 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -498,6 +498,7 @@ engines: - name : seedpeer engine : seedpeer shortcut: speu + categories: files, music, videos disabled: True - name : dictzone From 8b10eb6fe197cf136fa26f86e17dee1ffb851773 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Mon, 3 Oct 2016 14:10:00 +0200 Subject: [PATCH 13/23] [enh] update certifi to the current latest --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 029c0cffa..c4cbe4e04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -certifi==2016.2.28 +certifi==2016.9.26 flask==0.11.1 flask-babel==0.11.1 lxml==3.6.0 From 96cfdc77d241fff9c6ca500a919b3d3f598e414d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 9 Oct 2016 01:12:56 +0200 Subject: [PATCH 14/23] [fix] set the title on the opensearch link tag Firefox uses the title attributes instead of the ShortName from the xml file as set in 0fbd7052 which closed #405 --- searx/templates/courgette/base.html | 2 +- searx/templates/legacy/base.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/templates/courgette/base.html b/searx/templates/courgette/base.html index b2c70a3b7..8e272585c 100644 --- a/searx/templates/courgette/base.html +++ b/searx/templates/courgette/base.html @@ -22,7 +22,7 @@ {% endblock %} {% block meta %}{% endblock %} {% block head %} - + {% endblock %}