Browse Source

[fix] unicode urls

Adam Tauber 8 years ago
parent
commit
3144ec1d59
2 changed files with 3 additions and 8 deletions
  1. 1
    2
      searx/engines/dictzone.py
  2. 2
    6
      searx/engines/translated.py

+ 1
- 2
searx/engines/dictzone.py View File

13
 from urlparse import urljoin
13
 from urlparse import urljoin
14
 from lxml import html
14
 from lxml import html
15
 from cgi import escape
15
 from cgi import escape
16
-from searx.engines.xpath import extract_text
17
 from searx.utils import is_valid_lang
16
 from searx.utils import is_valid_lang
18
 
17
 
19
 categories = ['general']
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
 weight = 100
20
 weight = 100
22
 
21
 
23
 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) ([^ ]+)$', re.I)
22
 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) ([^ ]+)$', re.I)

+ 2
- 6
searx/engines/translated.py View File

9
  @parse       url, title, content
9
  @parse       url, title, content
10
 """
10
 """
11
 import re
11
 import re
12
-from urlparse import urljoin
13
-from lxml import html
14
 from cgi import escape
12
 from cgi import escape
15
-from searx.engines.xpath import extract_text
16
 from searx.utils import is_valid_lang
13
 from searx.utils import is_valid_lang
17
 
14
 
18
 categories = ['general']
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
 weight = 100
18
 weight = 100
23
 
19
 
24
 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)
20
 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)