@@ -13,24 +13,23 @@
1313# @todo set content-parameter with correct data
1414
1515from urllib import urlencode
16−from HTMLParser import HTMLParser
1716from lxml import html
18−from searx.engines.xpath import extract_text
1917from dateutil import parser
18+from cgi import escape
2019
2120# engine dependent config
2221categories = ['videos']
2322paging = True
2423
2524# search-url
26−base_url = 'https://vimeo.com'
25+base_url = 'http://vimeo.com'
2726search_url = base_url + '/search/page:{pageno}?{query}'
2827
2928# specific xpath variables
29+results_xpath = '//div[@id="browse_content"]/ol/li'
3030url_xpath = './a/@href'
31+title_xpath = './a/div[@class="data"]/p[@class="title"]'
3132content_xpath = './a/img/@src'
32−title_xpath = './a/div[@class="data"]/p[@class="title"]/text()'
33−results_xpath = '//div[@id="browse_content"]/ol/li'
3433publishedDate_xpath = './/p[@class="meta"]//attribute::datetime'
3534
3635
@@ -39,10 +38,6 @@ def request(query, params):
3938 params['url'] = search_url.format(pageno=params['pageno'],
4039 query=urlencode({'q': query}))
4140
42− # TODO required?
43− params['cookies']['__utma'] =\
44− '00000000.000#0000000.0000000000.0000000000.0000000000.0'
45−
4641 return params
4742
4843
@@ -52,15 +47,12 @@ def response(resp):
5247
5348 dom = html.fromstring(resp.text)
5449
55− p = HTMLParser()
56−
5750 # parse results
5851 for result in dom.xpath(results_xpath):
5952 url = base_url + result.xpath(url_xpath)[0]
60− title = p.unescape(extract_text(result.xpath(title_xpath)))
61− thumbnail = extract_text(result.xpath(content_xpath)[0])
62− publishedDate = parser.parse(extract_text(
63− result.xpath(publishedDate_xpath)[0]))
53+ title = escape(html.tostring(result.xpath(title_xpath)[0], method='text', encoding='UTF-8').decode("utf-8"))
54+ thumbnail = result.xpath(content_xpath)[0]
55+ publishedDate = parser.parse(result.xpath(publishedDate_xpath)[0])
6456
6557 # append result
6658 results.append({'url': url,