浏览代码

[fix] unicode urls

Adam Tauber 8 年前
父节点
当前提交
3144ec1d59
共有 2 个文件被更改,包括 3 次插入8 次删除
  1. 1
    2
      searx/engines/dictzone.py
  2. 2
    6
      searx/engines/translated.py

+ 1
- 2
searx/engines/dictzone.py 查看文件

@@ -13,11 +13,10 @@ import re
13 13
 from urlparse import urljoin
14 14
 from lxml import html
15 15
 from cgi import escape
16
-from searx.engines.xpath import extract_text
17 16
 from searx.utils import is_valid_lang
18 17
 
19 18
 categories = ['general']
20
-url = 'http://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
19
+url = u'http://dictzone.com/{from_lang}-{to_lang}-dictionary/{query}'
21 20
 weight = 100
22 21
 
23 22
 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) ([^ ]+)$', re.I)

+ 2
- 6
searx/engines/translated.py 查看文件

@@ -9,16 +9,12 @@
9 9
  @parse       url, title, content
10 10
 """
11 11
 import re
12
-from urlparse import urljoin
13
-from lxml import html
14 12
 from cgi import escape
15
-from searx.engines.xpath import extract_text
16 13
 from searx.utils import is_valid_lang
17 14
 
18 15
 categories = ['general']
19
-url = 'http://api.mymemory.translated.net/get?q={query}' \
20
-      '&langpair={from_lang}|{to_lang}{key}'
21
-web_url = 'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
16
+url = u'http://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
17
+web_url = u'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
22 18
 weight = 100
23 19
 
24 20
 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)