Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16bdc0ba authored by Adam Tauber's avatar Adam Tauber
Browse files

[mod] do not escape html content in engines

parent 28f12ef5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@
"""

from urlparse import urljoin
from cgi import escape
from urllib import urlencode
from lxml import html
from searx.engines.xpath import extract_text
@@ -135,7 +134,7 @@ def response(resp):
    for result in dom.xpath(xpath_results):
        link = result.xpath(xpath_link)[0]
        href = urljoin(base_url, link.attrib.get('href'))
        title = escape(extract_text(link))
        title = extract_text(link)

        results.append({'url': href,
                        'title': title})
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
from lxml import etree
from urllib import urlencode
from searx.utils import searx_useragent
from cgi import escape
from datetime import datetime
import re

@@ -94,7 +93,7 @@ def response(resp):
                url = item.text

            elif item.attrib["name"] == "dcdescription":
                content = escape(item.text[:300])
                content = item.text[:300]
                if len(item.text) > 300:
                    content += "..."

+2 −3
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
"""

from urllib import urlencode
from cgi import escape
from lxml import html
from searx.engines.xpath import extract_text

@@ -61,7 +60,7 @@ def response(resp):
        link = result.xpath('.//h3/a')[0]
        url = link.attrib.get('href')
        title = extract_text(link)
        content = escape(extract_text(result.xpath('.//p')))
        content = extract_text(result.xpath('.//p'))

        # append result
        results.append({'url': url,
@@ -73,7 +72,7 @@ def response(resp):
        link = result.xpath('.//h2/a')[0]
        url = link.attrib.get('href')
        title = extract_text(link)
        content = escape(extract_text(result.xpath('.//p')))
        content = extract_text(result.xpath('.//p'))

        # append result
        results.append({'url': url,
+2 −3
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
"""

from urlparse import urljoin
from cgi import escape
from urllib import quote
from lxml import html
from operator import itemgetter
@@ -51,8 +50,8 @@ def response(resp):
    for result in search_res:
        link = result.xpath('.//td[@class="torrent_name"]//a')[0]
        href = urljoin(url, link.attrib.get('href'))
        title = escape(extract_text(link))
        content = escape(extract_text(result.xpath('.//pre[@class="snippet"]')[0]))
        title = extract_text(link)
        content = extract_text(result.xpath('.//pre[@class="snippet"]')[0])
        content = "<br />".join(content.split("\n"))

        filesize = result.xpath('.//span[@class="attr_val"]/text()')[0].split()[0]
+1 −2
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@

from urllib import urlencode
from json import loads
from cgi import escape
from datetime import datetime

# engine dependent config
@@ -57,7 +56,7 @@ def response(resp):
    for res in search_res['list']:
        title = res['title']
        url = res['url']
        content = escape(res['description'])
        content = res['description']
        thumbnail = res['thumbnail_360_url']
        publishedDate = datetime.fromtimestamp(res['created_time'], None)
        embedded = embedded_url.format(videoid=res['id'])
Loading