소스 검색

[mod] do not escape html content in engines

Adam Tauber 8 년 전
부모
커밋
16bdc0baf4

+ 1
- 2
searx/engines/archlinux.py 파일 보기

12
 """
12
 """
13
 
13
 
14
 from urlparse import urljoin
14
 from urlparse import urljoin
15
-from cgi import escape
16
 from urllib import urlencode
15
 from urllib import urlencode
17
 from lxml import html
16
 from lxml import html
18
 from searx.engines.xpath import extract_text
17
 from searx.engines.xpath import extract_text
135
     for result in dom.xpath(xpath_results):
134
     for result in dom.xpath(xpath_results):
136
         link = result.xpath(xpath_link)[0]
135
         link = result.xpath(xpath_link)[0]
137
         href = urljoin(base_url, link.attrib.get('href'))
136
         href = urljoin(base_url, link.attrib.get('href'))
138
-        title = escape(extract_text(link))
137
+        title = extract_text(link)
139
 
138
 
140
         results.append({'url': href,
139
         results.append({'url': href,
141
                         'title': title})
140
                         'title': title})

+ 1
- 2
searx/engines/base.py 파일 보기

16
 from lxml import etree
16
 from lxml import etree
17
 from urllib import urlencode
17
 from urllib import urlencode
18
 from searx.utils import searx_useragent
18
 from searx.utils import searx_useragent
19
-from cgi import escape
20
 from datetime import datetime
19
 from datetime import datetime
21
 import re
20
 import re
22
 
21
 
94
                 url = item.text
93
                 url = item.text
95
 
94
 
96
             elif item.attrib["name"] == "dcdescription":
95
             elif item.attrib["name"] == "dcdescription":
97
-                content = escape(item.text[:300])
96
+                content = item.text[:300]
98
                 if len(item.text) > 300:
97
                 if len(item.text) > 300:
99
                     content += "..."
98
                     content += "..."
100
 
99
 

+ 2
- 3
searx/engines/bing.py 파일 보기

14
 """
14
 """
15
 
15
 
16
 from urllib import urlencode
16
 from urllib import urlencode
17
-from cgi import escape
18
 from lxml import html
17
 from lxml import html
19
 from searx.engines.xpath import extract_text
18
 from searx.engines.xpath import extract_text
20
 
19
 
61
         link = result.xpath('.//h3/a')[0]
60
         link = result.xpath('.//h3/a')[0]
62
         url = link.attrib.get('href')
61
         url = link.attrib.get('href')
63
         title = extract_text(link)
62
         title = extract_text(link)
64
-        content = escape(extract_text(result.xpath('.//p')))
63
+        content = extract_text(result.xpath('.//p'))
65
 
64
 
66
         # append result
65
         # append result
67
         results.append({'url': url,
66
         results.append({'url': url,
73
         link = result.xpath('.//h2/a')[0]
72
         link = result.xpath('.//h2/a')[0]
74
         url = link.attrib.get('href')
73
         url = link.attrib.get('href')
75
         title = extract_text(link)
74
         title = extract_text(link)
76
-        content = escape(extract_text(result.xpath('.//p')))
75
+        content = extract_text(result.xpath('.//p'))
77
 
76
 
78
         # append result
77
         # append result
79
         results.append({'url': url,
78
         results.append({'url': url,

+ 2
- 3
searx/engines/btdigg.py 파일 보기

11
 """
11
 """
12
 
12
 
13
 from urlparse import urljoin
13
 from urlparse import urljoin
14
-from cgi import escape
15
 from urllib import quote
14
 from urllib import quote
16
 from lxml import html
15
 from lxml import html
17
 from operator import itemgetter
16
 from operator import itemgetter
51
     for result in search_res:
50
     for result in search_res:
52
         link = result.xpath('.//td[@class="torrent_name"]//a')[0]
51
         link = result.xpath('.//td[@class="torrent_name"]//a')[0]
53
         href = urljoin(url, link.attrib.get('href'))
52
         href = urljoin(url, link.attrib.get('href'))
54
-        title = escape(extract_text(link))
55
-        content = escape(extract_text(result.xpath('.//pre[@class="snippet"]')[0]))
53
+        title = extract_text(link)
54
+        content = extract_text(result.xpath('.//pre[@class="snippet"]')[0])
56
         content = "<br />".join(content.split("\n"))
55
         content = "<br />".join(content.split("\n"))
57
 
56
 
58
         filesize = result.xpath('.//span[@class="attr_val"]/text()')[0].split()[0]
57
         filesize = result.xpath('.//span[@class="attr_val"]/text()')[0].split()[0]

+ 1
- 2
searx/engines/dailymotion.py 파일 보기

14
 
14
 
15
 from urllib import urlencode
15
 from urllib import urlencode
16
 from json import loads
16
 from json import loads
17
-from cgi import escape
18
 from datetime import datetime
17
 from datetime import datetime
19
 
18
 
20
 # engine dependent config
19
 # engine dependent config
57
     for res in search_res['list']:
56
     for res in search_res['list']:
58
         title = res['title']
57
         title = res['title']
59
         url = res['url']
58
         url = res['url']
60
-        content = escape(res['description'])
59
+        content = res['description']
61
         thumbnail = res['thumbnail_360_url']
60
         thumbnail = res['thumbnail_360_url']
62
         publishedDate = datetime.fromtimestamp(res['created_time'], None)
61
         publishedDate = datetime.fromtimestamp(res['created_time'], None)
63
         embedded = embedded_url.format(videoid=res['id'])
62
         embedded = embedded_url.format(videoid=res['id'])

+ 5
- 4
searx/engines/deezer.py 파일 보기

51
             if url.startswith('http://'):
51
             if url.startswith('http://'):
52
                 url = 'https' + url[4:]
52
                 url = 'https' + url[4:]
53
 
53
 
54
-            content = result['artist']['name'] +\
55
-                " &bull; " +\
56
-                result['album']['title'] +\
57
-                " &bull; " + result['title']
54
+            content = '{} - {} - {}'.format(
55
+                result['artist']['name'],
56
+                result['album']['title'],
57
+                result['title'])
58
+
58
             embedded = embedded_url.format(audioid=result['id'])
59
             embedded = embedded_url.format(audioid=result['id'])
59
 
60
 
60
             # append result
61
             # append result

+ 2
- 3
searx/engines/dictzone.py 파일 보기

12
 import re
12
 import re
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
16
 from searx.utils import is_valid_lang
15
 from searx.utils import is_valid_lang
17
 
16
 
18
 categories = ['general']
17
 categories = ['general']
62
 
61
 
63
         results.append({
62
         results.append({
64
             'url': urljoin(resp.url, '?%d' % k),
63
             'url': urljoin(resp.url, '?%d' % k),
65
-            'title': escape(from_result.text_content()),
66
-            'content': escape('; '.join(to_results))
64
+            'title': from_result.text_content(),
65
+            'content': '; '.join(to_results)
67
         })
66
         })
68
 
67
 
69
     return results
68
     return results

+ 1
- 2
searx/engines/digg.py 파일 보기

13
 from urllib import quote_plus
13
 from urllib import quote_plus
14
 from json import loads
14
 from json import loads
15
 from lxml import html
15
 from lxml import html
16
-from cgi import escape
17
 from dateutil import parser
16
 from dateutil import parser
18
 
17
 
19
 # engine dependent config
18
 # engine dependent config
56
         url = result.attrib.get('data-contenturl')
55
         url = result.attrib.get('data-contenturl')
57
         thumbnail = result.xpath('.//img')[0].attrib.get('src')
56
         thumbnail = result.xpath('.//img')[0].attrib.get('src')
58
         title = ''.join(result.xpath(title_xpath))
57
         title = ''.join(result.xpath(title_xpath))
59
-        content = escape(''.join(result.xpath(content_xpath)))
58
+        content = ''.join(result.xpath(content_xpath))
60
         pubdate = result.xpath(pubdate_xpath)[0].attrib.get('datetime')
59
         pubdate = result.xpath(pubdate_xpath)[0].attrib.get('datetime')
61
         publishedDate = parser.parse(pubdate)
60
         publishedDate = parser.parse(pubdate)
62
 
61
 

+ 1
- 2
searx/engines/fdroid.py 파일 보기

9
  @parse        url, title, content
9
  @parse        url, title, content
10
 """
10
 """
11
 
11
 
12
-from cgi import escape
13
 from urllib import urlencode
12
 from urllib import urlencode
14
 from searx.engines.xpath import extract_text
13
 from searx.engines.xpath import extract_text
15
 from lxml import html
14
 from lxml import html
43
         img_src = app.xpath('.//img/@src')[0]
42
         img_src = app.xpath('.//img/@src')[0]
44
 
43
 
45
         content = extract_text(app.xpath('./p')[0])
44
         content = extract_text(app.xpath('./p')[0])
46
-        content = escape(content.replace(title, '', 1).strip())
45
+        content = content.replace(title, '', 1).strip()
47
 
46
 
48
         results.append({'url': url,
47
         results.append({'url': url,
49
                         'title': title,
48
                         'title': title,

+ 3
- 11
searx/engines/flickr.py 파일 보기

77
 
77
 
78
         url = build_flickr_url(photo['owner'], photo['id'])
78
         url = build_flickr_url(photo['owner'], photo['id'])
79
 
79
 
80
-        title = photo['title']
81
-
82
-        content = '<span class="photo-author">' +\
83
-                  photo['ownername'] +\
84
-                  '</span><br />' +\
85
-                  '<span class="description">' +\
86
-                  photo['description']['_content'] +\
87
-                  '</span>'
88
-
89
         # append result
80
         # append result
90
         results.append({'url': url,
81
         results.append({'url': url,
91
-                        'title': title,
82
+                        'title': photo['title'],
92
                         'img_src': img_src,
83
                         'img_src': img_src,
93
                         'thumbnail_src': thumbnail_src,
84
                         'thumbnail_src': thumbnail_src,
94
-                        'content': content,
85
+                        'content': content = photo['description']['_content'],
86
+                        'author': photo['ownername'],
95
                         'template': 'images.html'})
87
                         'template': 'images.html'})
96
 
88
 
97
     # return results
89
     # return results

+ 3
- 4
searx/engines/flickr_noapi.py 파일 보기

102
 
102
 
103
         title = photo.get('title', '')
103
         title = photo.get('title', '')
104
 
104
 
105
-        content = '<span class="photo-author">' +\
106
-                  photo['username'] +\
107
-                  '</span><br />'
105
+        author = photo['username']
108
 
106
 
109
         # append result
107
         # append result
110
         results.append({'url': url,
108
         results.append({'url': url,
111
                         'title': title,
109
                         'title': title,
112
                         'img_src': img_src,
110
                         'img_src': img_src,
113
                         'thumbnail_src': thumbnail_src,
111
                         'thumbnail_src': thumbnail_src,
114
-                        'content': content,
112
+                        'content': '',
113
+                        'author': author,
115
                         'template': 'images.html'})
114
                         'template': 'images.html'})
116
 
115
 
117
     return results
116
     return results

+ 2
- 3
searx/engines/gigablast.py 파일 보기

10
  @parse       url, title, content
10
  @parse       url, title, content
11
 """
11
 """
12
 
12
 
13
-from cgi import escape
14
 from json import loads
13
 from json import loads
15
 from random import randint
14
 from random import randint
16
 from time import time
15
 from time import time
78
     for result in response_json['results']:
77
     for result in response_json['results']:
79
         # append result
78
         # append result
80
         results.append({'url': result['url'],
79
         results.append({'url': result['url'],
81
-                        'title': escape(result['title']),
82
-                        'content': escape(result['sum'])})
80
+                        'title': result['title'],
81
+                        'content': result['sum']})
83
 
82
 
84
     # return results
83
     # return results
85
     return results
84
     return results

+ 1
- 2
searx/engines/github.py 파일 보기

12
 
12
 
13
 from urllib import urlencode
13
 from urllib import urlencode
14
 from json import loads
14
 from json import loads
15
-from cgi import escape
16
 
15
 
17
 # engine dependent config
16
 # engine dependent config
18
 categories = ['it']
17
 categories = ['it']
48
         url = res['html_url']
47
         url = res['html_url']
49
 
48
 
50
         if res['description']:
49
         if res['description']:
51
-            content = escape(res['description'][:500])
50
+            content = res['description'][:500]
52
         else:
51
         else:
53
             content = ''
52
             content = ''
54
 
53
 

+ 2
- 3
searx/engines/google.py 파일 보기

9
 # @parse       url, title, content, suggestion
9
 # @parse       url, title, content, suggestion
10
 
10
 
11
 import re
11
 import re
12
-from cgi import escape
13
 from urllib import urlencode
12
 from urllib import urlencode
14
 from urlparse import urlparse, parse_qsl
13
 from urlparse import urlparse, parse_qsl
15
 from lxml import html, etree
14
 from lxml import html, etree
155
 def extract_text_from_dom(result, xpath):
154
 def extract_text_from_dom(result, xpath):
156
     r = result.xpath(xpath)
155
     r = result.xpath(xpath)
157
     if len(r) > 0:
156
     if len(r) > 0:
158
-        return escape(extract_text(r[0]))
157
+        return extract_text(r[0])
159
     return None
158
     return None
160
 
159
 
161
 
160
 
264
     # parse suggestion
263
     # parse suggestion
265
     for suggestion in dom.xpath(suggestion_xpath):
264
     for suggestion in dom.xpath(suggestion_xpath):
266
         # append suggestion
265
         # append suggestion
267
-        results.append({'suggestion': escape(extract_text(suggestion))})
266
+        results.append({'suggestion': extract_text(suggestion)})
268
 
267
 
269
     # return results
268
     # return results
270
     return results
269
     return results

+ 1
- 2
searx/engines/kickass.py 파일 보기

11
 """
11
 """
12
 
12
 
13
 from urlparse import urljoin
13
 from urlparse import urljoin
14
-from cgi import escape
15
 from urllib import quote
14
 from urllib import quote
16
 from lxml import html
15
 from lxml import html
17
 from operator import itemgetter
16
 from operator import itemgetter
57
         link = result.xpath('.//a[@class="cellMainLink"]')[0]
56
         link = result.xpath('.//a[@class="cellMainLink"]')[0]
58
         href = urljoin(url, link.attrib['href'])
57
         href = urljoin(url, link.attrib['href'])
59
         title = extract_text(link)
58
         title = extract_text(link)
60
-        content = escape(extract_text(result.xpath(content_xpath)))
59
+        content = extract_text(result.xpath(content_xpath))
61
         seed = extract_text(result.xpath('.//td[contains(@class, "green")]'))
60
         seed = extract_text(result.xpath('.//td[contains(@class, "green")]'))
62
         leech = extract_text(result.xpath('.//td[contains(@class, "red")]'))
61
         leech = extract_text(result.xpath('.//td[contains(@class, "red")]'))
63
         filesize_info = extract_text(result.xpath('.//td[contains(@class, "nobr")]'))
62
         filesize_info = extract_text(result.xpath('.//td[contains(@class, "nobr")]'))

+ 2
- 4
searx/engines/nyaa.py 파일 보기

9
  @parse        url, title, content, seed, leech, torrentfile
9
  @parse        url, title, content, seed, leech, torrentfile
10
 """
10
 """
11
 
11
 
12
-from cgi import escape
13
 from urllib import urlencode
12
 from urllib import urlencode
14
 from lxml import html
13
 from lxml import html
15
 from searx.engines.xpath import extract_text
14
 from searx.engines.xpath import extract_text
78
 
77
 
79
         # torrent title
78
         # torrent title
80
         page_a = result.xpath(xpath_title)[0]
79
         page_a = result.xpath(xpath_title)[0]
81
-        title = escape(extract_text(page_a))
80
+        title = extract_text(page_a)
82
 
81
 
83
         # link to the page
82
         # link to the page
84
         href = page_a.attrib.get('href')
83
         href = page_a.attrib.get('href')
90
         try:
89
         try:
91
             file_size, suffix = result.xpath(xpath_filesize)[0].split(' ')
90
             file_size, suffix = result.xpath(xpath_filesize)[0].split(' ')
92
             file_size = int(float(file_size) * get_filesize_mul(suffix))
91
             file_size = int(float(file_size) * get_filesize_mul(suffix))
93
-        except Exception as e:
92
+        except:
94
             file_size = None
93
             file_size = None
95
 
94
 
96
         # seed count
95
         # seed count
105
         # content string contains all information not included into template
104
         # content string contains all information not included into template
106
         content = 'Category: "{category}". Downloaded {downloads} times.'
105
         content = 'Category: "{category}". Downloaded {downloads} times.'
107
         content = content.format(category=category, downloads=downloads)
106
         content = content.format(category=category, downloads=downloads)
108
-        content = escape(content)
109
 
107
 
110
         results.append({'url': href,
108
         results.append({'url': href,
111
                         'title': title,
109
                         'title': title,

+ 1
- 2
searx/engines/piratebay.py 파일 보기

9
 # @parse       url, title, content, seed, leech, magnetlink
9
 # @parse       url, title, content, seed, leech, magnetlink
10
 
10
 
11
 from urlparse import urljoin
11
 from urlparse import urljoin
12
-from cgi import escape
13
 from urllib import quote
12
 from urllib import quote
14
 from lxml import html
13
 from lxml import html
15
 from operator import itemgetter
14
 from operator import itemgetter
62
         link = result.xpath('.//div[@class="detName"]//a')[0]
61
         link = result.xpath('.//div[@class="detName"]//a')[0]
63
         href = urljoin(url, link.attrib.get('href'))
62
         href = urljoin(url, link.attrib.get('href'))
64
         title = extract_text(link)
63
         title = extract_text(link)
65
-        content = escape(extract_text(result.xpath(content_xpath)))
64
+        content = extract_text(result.xpath(content_xpath))
66
         seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
65
         seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
67
 
66
 
68
         # convert seed to int if possible
67
         # convert seed to int if possible

+ 1
- 2
searx/engines/reddit.py 파일 보기

11
 """
11
 """
12
 
12
 
13
 import json
13
 import json
14
-from cgi import escape
15
 from urllib import urlencode
14
 from urllib import urlencode
16
 from urlparse import urlparse, urljoin
15
 from urlparse import urlparse, urljoin
17
 from datetime import datetime
16
 from datetime import datetime
68
             img_results.append(params)
67
             img_results.append(params)
69
         else:
68
         else:
70
             created = datetime.fromtimestamp(data['created_utc'])
69
             created = datetime.fromtimestamp(data['created_utc'])
71
-            content = escape(data['selftext'])
70
+            content = data['selftext']
72
             if len(content) > 500:
71
             if len(content) > 500:
73
                 content = content[:500] + '...'
72
                 content = content[:500] + '...'
74
             params['content'] = content
73
             params['content'] = content

+ 2
- 10
searx/engines/searchcode_doc.py 파일 보기

44
     # parse results
44
     # parse results
45
     for result in search_results.get('results', []):
45
     for result in search_results.get('results', []):
46
         href = result['url']
46
         href = result['url']
47
-        title = "[" + result['type'] + "] " +\
48
-                result['namespace'] +\
49
-                " " + result['name']
50
-        content = '<span class="highlight">[' +\
51
-                  result['type'] + "] " +\
52
-                  result['name'] + " " +\
53
-                  result['synopsis'] +\
54
-                  "</span><br />" +\
55
-                  result['description']
47
+        title = "[{}] {} {}".format(result['type'], result['namespace'], result['name'])
56
 
48
 
57
         # append result
49
         # append result
58
         results.append({'url': href,
50
         results.append({'url': href,
59
                         'title': title,
51
                         'title': title,
60
-                        'content': content})
52
+                        'content': result['description']})
61
 
53
 
62
     # return results
54
     # return results
63
     return results
55
     return results

+ 0
- 1
searx/engines/seedpeer.py 파일 보기

9
 # @parse       url, title, content, seed, leech, magnetlink
9
 # @parse       url, title, content, seed, leech, magnetlink
10
 
10
 
11
 from urlparse import urljoin
11
 from urlparse import urljoin
12
-from cgi import escape
13
 from urllib import quote
12
 from urllib import quote
14
 from lxml import html
13
 from lxml import html
15
 from operator import itemgetter
14
 from operator import itemgetter

+ 5
- 4
searx/engines/spotify.py 파일 보기

46
         if result['type'] == 'track':
46
         if result['type'] == 'track':
47
             title = result['name']
47
             title = result['name']
48
             url = result['external_urls']['spotify']
48
             url = result['external_urls']['spotify']
49
-            content = result['artists'][0]['name'] +\
50
-                " &bull; " +\
51
-                result['album']['name'] +\
52
-                " &bull; " + result['name']
49
+            content = '{} - {} - {}'.format(
50
+                result['artists'][0]['name'],
51
+                result['album']['name'],
52
+                result['name'])
53
+
53
             embedded = embedded_url.format(audioid=result['id'])
54
             embedded = embedded_url.format(audioid=result['id'])
54
 
55
 
55
             # append result
56
             # append result

+ 2
- 3
searx/engines/stackoverflow.py 파일 보기

11
 """
11
 """
12
 
12
 
13
 from urlparse import urljoin
13
 from urlparse import urljoin
14
-from cgi import escape
15
 from urllib import urlencode
14
 from urllib import urlencode
16
 from lxml import html
15
 from lxml import html
17
 from searx.engines.xpath import extract_text
16
 from searx.engines.xpath import extract_text
48
     for result in dom.xpath(results_xpath):
47
     for result in dom.xpath(results_xpath):
49
         link = result.xpath(link_xpath)[0]
48
         link = result.xpath(link_xpath)[0]
50
         href = urljoin(url, link.attrib.get('href'))
49
         href = urljoin(url, link.attrib.get('href'))
51
-        title = escape(extract_text(link))
52
-        content = escape(extract_text(result.xpath(content_xpath)))
50
+        title = extract_text(link)
51
+        content = extract_text(result.xpath(content_xpath))
53
 
52
 
54
         # append result
53
         # append result
55
         results.append({'url': href,
54
         results.append({'url': href,

+ 2
- 3
searx/engines/startpage.py 파일 보기

11
 # @todo        paging
11
 # @todo        paging
12
 
12
 
13
 from lxml import html
13
 from lxml import html
14
-from cgi import escape
15
 from dateutil import parser
14
 from dateutil import parser
16
 from datetime import datetime, timedelta
15
 from datetime import datetime, timedelta
17
 import re
16
 import re
79
         if re.match(r"^http(s|)://(www\.)?ixquick\.com/do/search\?.*$", url):
78
         if re.match(r"^http(s|)://(www\.)?ixquick\.com/do/search\?.*$", url):
80
             continue
79
             continue
81
 
80
 
82
-        title = escape(extract_text(link))
81
+        title = extract_text(link)
83
 
82
 
84
         if result.xpath('./p[@class="desc clk"]'):
83
         if result.xpath('./p[@class="desc clk"]'):
85
-            content = escape(extract_text(result.xpath('./p[@class="desc clk"]')))
84
+            content = extract_text(result.xpath('./p[@class="desc clk"]'))
86
         else:
85
         else:
87
             content = ''
86
             content = ''
88
 
87
 

+ 2
- 3
searx/engines/subtitleseeker.py 파일 보기

10
  @parse       url, title, content
10
  @parse       url, title, content
11
 """
11
 """
12
 
12
 
13
-from cgi import escape
14
 from urllib import quote_plus
13
 from urllib import quote_plus
15
 from lxml import html
14
 from lxml import html
16
 from searx.languages import language_codes
15
 from searx.languages import language_codes
59
         elif search_lang:
58
         elif search_lang:
60
             href = href + search_lang + '/'
59
             href = href + search_lang + '/'
61
 
60
 
62
-        title = escape(extract_text(link))
61
+        title = extract_text(link)
63
 
62
 
64
         content = extract_text(result.xpath('.//div[contains(@class,"red")]'))
63
         content = extract_text(result.xpath('.//div[contains(@class,"red")]'))
65
         content = content + " - "
64
         content = content + " - "
75
         # append result
74
         # append result
76
         results.append({'url': href,
75
         results.append({'url': href,
77
                         'title': title,
76
                         'title': title,
78
-                        'content': escape(content)})
77
+                        'content': content})
79
 
78
 
80
     # return results
79
     # return results
81
     return results
80
     return results

+ 4
- 5
searx/engines/swisscows.py 파일 보기

10
  @parse       url, title, content
10
  @parse       url, title, content
11
 """
11
 """
12
 
12
 
13
-from cgi import escape
14
 from json import loads
13
 from json import loads
15
 from urllib import urlencode, unquote
14
 from urllib import urlencode, unquote
16
 import re
15
 import re
78
 
77
 
79
             # append result
78
             # append result
80
             results.append({'url': result['SourceUrl'],
79
             results.append({'url': result['SourceUrl'],
81
-                            'title': escape(result['Title']),
80
+                            'title': result['Title'],
82
                             'content': '',
81
                             'content': '',
83
                             'img_src': img_url,
82
                             'img_src': img_url,
84
                             'template': 'images.html'})
83
                             'template': 'images.html'})
90
 
89
 
91
             # append result
90
             # append result
92
             results.append({'url': result_url,
91
             results.append({'url': result_url,
93
-                            'title': escape(result_title),
94
-                            'content': escape(result_content)})
92
+                            'title': result_title,
93
+                            'content': result_content})
95
 
94
 
96
     # parse images
95
     # parse images
97
     for result in json.get('Images', []):
96
     for result in json.get('Images', []):
100
 
99
 
101
         # append result
100
         # append result
102
         results.append({'url': result['SourceUrl'],
101
         results.append({'url': result['SourceUrl'],
103
-                        'title': escape(result['Title']),
102
+                        'title': result['Title'],
104
                         'content': '',
103
                         'content': '',
105
                         'img_src': img_url,
104
                         'img_src': img_url,
106
                         'template': 'images.html'})
105
                         'template': 'images.html'})

+ 0
- 1
searx/engines/tokyotoshokan.py 파일 보기

11
 """
11
 """
12
 
12
 
13
 import re
13
 import re
14
-from cgi import escape
15
 from urllib import urlencode
14
 from urllib import urlencode
16
 from lxml import html
15
 from lxml import html
17
 from searx.engines.xpath import extract_text
16
 from searx.engines.xpath import extract_text

+ 0
- 1
searx/engines/torrentz.py 파일 보기

12
 """
12
 """
13
 
13
 
14
 import re
14
 import re
15
-from cgi import escape
16
 from urllib import urlencode
15
 from urllib import urlencode
17
 from lxml import html
16
 from lxml import html
18
 from searx.engines.xpath import extract_text
17
 from searx.engines.xpath import extract_text

+ 5
- 6
searx/engines/translated.py 파일 보기

9
  @parse       url, title, content
9
  @parse       url, title, content
10
 """
10
 """
11
 import re
11
 import re
12
-from cgi import escape
13
 from searx.utils import is_valid_lang
12
 from searx.utils import is_valid_lang
14
 
13
 
15
 categories = ['general']
14
 categories = ['general']
52
 def response(resp):
51
 def response(resp):
53
     results = []
52
     results = []
54
     results.append({
53
     results.append({
55
-        'url': escape(web_url.format(
54
+        'url': web_url.format(
56
             from_lang=resp.search_params['from_lang'][2],
55
             from_lang=resp.search_params['from_lang'][2],
57
             to_lang=resp.search_params['to_lang'][2],
56
             to_lang=resp.search_params['to_lang'][2],
58
-            query=resp.search_params['query'])),
59
-        'title': escape('[{0}-{1}] {2}'.format(
57
+            query=resp.search_params['query']),
58
+        'title': '[{0}-{1}] {2}'.format(
60
             resp.search_params['from_lang'][1],
59
             resp.search_params['from_lang'][1],
61
             resp.search_params['to_lang'][1],
60
             resp.search_params['to_lang'][1],
62
-            resp.search_params['query'])),
63
-        'content': escape(resp.json()['responseData']['translatedText'])
61
+            resp.search_params['query']),
62
+        'content': resp.json()['responseData']['translatedText']
64
     })
63
     })
65
     return results
64
     return results

+ 0
- 1
searx/engines/wolframalpha_noapi.py 파일 보기

8
 # @stable      no
8
 # @stable      no
9
 # @parse       url, infobox
9
 # @parse       url, infobox
10
 
10
 
11
-from cgi import escape
12
 from json import loads
11
 from json import loads
13
 from time import time
12
 from time import time
14
 from urllib import urlencode
13
 from urllib import urlencode

+ 2
- 3
searx/engines/yandex.py 파일 보기

9
  @parse       url, title, content
9
  @parse       url, title, content
10
 """
10
 """
11
 
11
 
12
-from cgi import escape
13
 from urllib import urlencode
12
 from urllib import urlencode
14
 from lxml import html
13
 from lxml import html
15
 from searx.search import logger
14
 from searx.search import logger
52
     for result in dom.xpath(results_xpath):
51
     for result in dom.xpath(results_xpath):
53
         try:
52
         try:
54
             res = {'url': result.xpath(url_xpath)[0],
53
             res = {'url': result.xpath(url_xpath)[0],
55
-                   'title': escape(''.join(result.xpath(title_xpath))),
56
-                   'content': escape(''.join(result.xpath(content_xpath)))}
54
+                   'title': ''.join(result.xpath(title_xpath)),
55
+                   'content': ''.join(result.xpath(content_xpath))}
57
         except:
56
         except:
58
             logger.exception('yandex parse crash')
57
             logger.exception('yandex parse crash')
59
             continue
58
             continue