summaryrefslogtreecommitdiff
path: root/searx/engines/vimeo.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2014-01-20 02:31:20 +0100
committerasciimoo <asciimoo@gmail.com>2014-01-20 02:31:20 +0100
commitb2492c94f422e18cb8954ec983134f4fa5c7cdc0 (patch)
tree969ea30e5dc642d896fa7b744571110ebfe13e7a /searx/engines/vimeo.py
parent692c0bf5f0b353bfbb46aaee1af54afb164dedbc (diff)
downloadsearxng-b2492c94f422e18cb8954ec983134f4fa5c7cdc0.tar.gz
searxng-b2492c94f422e18cb8954ec983134f4fa5c7cdc0.zip
[fix] pep/flake8 compatibility
Diffstat (limited to 'searx/engines/vimeo.py')
-rw-r--r--searx/engines/vimeo.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/searx/engines/vimeo.py b/searx/engines/vimeo.py
index 35bc3d50a..924497a99 100644
--- a/searx/engines/vimeo.py
+++ b/searx/engines/vimeo.py
@@ -5,27 +5,31 @@ from lxml import html
base_url = 'http://vimeo.com'
search_url = base_url + '/search?{query}'
-url_xpath = None
+url_xpath = None
content_xpath = None
-title_xpath = None
+title_xpath = None
results_xpath = ''
+content_tpl = '<a href="{0}"> <img src="{2}"/> </a>'
-# the cookie set by vimeo contains all the following values, but only __utma seems to be requiered
+# the cookie set by vimeo contains all the following values,
+# but only __utma seems to be requiered
cookie = {
#'vuid':'918282893.1027205400'
# 'ab_bs':'%7B%223%22%3A279%7D'
- '__utma':'00000000.000#0000000.0000000000.0000000000.0000000000.0'
+ '__utma': '00000000.000#0000000.0000000000.0000000000.0000000000.0'
# '__utmb':'18302654.1.10.1388942090'
#, '__utmc':'18302654'
- #, '__utmz':'18#302654.1388942090.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)'
+ #, '__utmz':'18#302654.1388942090.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)' # noqa
#, '__utml':'search'
}
+
def request(query, params):
- params['url'] = search_url.format(query=urlencode({'q' :query}))
+ params['url'] = search_url.format(query=urlencode({'q': query}))
params['cookies'] = cookie
return params
+
def response(resp):
results = []
dom = html.fromstring(resp.text)
@@ -36,10 +40,9 @@ def response(resp):
url = base_url + result.xpath(url_xpath)[0]
title = p.unescape(extract_text(result.xpath(title_xpath)))
thumbnail = extract_text(result.xpath(content_xpath)[0])
- content = '<a href="{0}"> <img src="{2}"/> </a>'.format(url, title, thumbnail)
- results.append({'url': url
- , 'title': title
- , 'content': content
- , 'template':'videos.html'
- , 'thumbnail': thumbnail})
+ results.append({'url': url,
+ 'title': title,
+ 'content': content_tpl.format(url, title, thumbnail),
+ 'template': 'videos.html',
+ 'thumbnail': thumbnail})
return results