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

Commit b3ab221b authored by stepshal's avatar stepshal
Browse files

Fix anomalous backslash in string

parent 3fd405dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ categories = []
url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
weight = 100

parser_re = re.compile(u'.*?(\d+(?:\.\d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)', re.I)  # noqa
parser_re = re.compile(u'.*?(\\d+(?:\\.\\d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)', re.I)  # noqa

db = 1

+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ def response(resp):

    dom = html.fromstring(resp.text)

    regex = re.compile('\/200H\/')
    regex = re.compile(r'\/200H\/')

    # parse results
    for result in dom.xpath('//div[contains(@class, "tt-a tt-fh")]'):
+2 −2
Original line number Diff line number Diff line
@@ -300,9 +300,9 @@ def parse_map_detail(parsed_url, result, google_hostname):
    results = []

    # try to parse the geoloc
    m = re.search('@([0-9\.]+),([0-9\.]+),([0-9]+)', parsed_url.path)
    m = re.search(r'@([0-9\.]+),([0-9\.]+),([0-9]+)', parsed_url.path)
    if m is None:
        m = re.search('ll\=([0-9\.]+),([0-9\.]+)\&z\=([0-9]+)', parsed_url.query)
        m = re.search(r'll\=([0-9\.]+),([0-9\.]+)\&z\=([0-9]+)', parsed_url.query)

    if m is not None:
        # geoloc found (ignored)
+5 −5
Original line number Diff line number Diff line
@@ -68,15 +68,15 @@ def response(resp):
        url = link.attrib.get('href')

        # block google-ad url's
        if re.match("^http(s|)://(www\.)?google\.[a-z]+/aclk.*$", url):
        if re.match(r"^http(s|)://(www\.)?google\.[a-z]+/aclk.*$", url):
            continue

        # block startpage search url's
        if re.match("^http(s|)://(www\.)?startpage\.com/do/search\?.*$", url):
        if re.match(r"^http(s|)://(www\.)?startpage\.com/do/search\?.*$", url):
            continue

        # block ixquick search url's
        if re.match("^http(s|)://(www\.)?ixquick\.com/do/search\?.*$", url):
        if re.match(r"^http(s|)://(www\.)?ixquick\.com/do/search\?.*$", url):
            continue

        title = escape(extract_text(link))
@@ -89,7 +89,7 @@ def response(resp):
        published_date = None

        # check if search result starts with something like: "2 Sep 2014 ... "
        if re.match("^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \.\.\. ", content):
        if re.match(r"^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \.\.\. ", content):
            date_pos = content.find('...') + 4
            date_string = content[0:date_pos - 5]
            published_date = parser.parse(date_string, dayfirst=True)
@@ -98,7 +98,7 @@ def response(resp):
            content = content[date_pos:]

        # check if search result starts with something like: "5 days ago ... "
        elif re.match("^[0-9]+ days? ago \.\.\. ", content):
        elif re.match(r"^[0-9]+ days? ago \.\.\. ", content):
            date_pos = content.find('...') + 4
            date_string = content[0:date_pos - 5]

+4 −4
Original line number Diff line number Diff line
@@ -25,10 +25,10 @@ base_url = 'https://swisscows.ch/'
search_string = '?{query}&page={page}'

# regex
regex_json = re.compile('initialData: {"Request":(.|\n)*},\s*environment')
regex_json_remove_start = re.compile('^initialData:\s*')
regex_json_remove_end = re.compile(',\s*environment$')
regex_img_url_remove_start = re.compile('^https?://i\.swisscows\.ch/\?link=')
regex_json = re.compile(r'initialData: {"Request":(.|\n)*},\s*environment')
regex_json_remove_start = re.compile(r'^initialData:\s*')
regex_json_remove_end = re.compile(r',\s*environment$')
regex_img_url_remove_start = re.compile(r'^https?://i\.swisscows\.ch/\?link=')


# do search-request
Loading