Browse Source

[mod] vimeo engine mods

asciimoo 11 years ago
parent
commit
0eb3cdf664
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      searx/engines/vimeo.py

+ 8
- 5
searx/engines/vimeo.py View File

5
 
5
 
6
 base_url = 'http://vimeo.com'
6
 base_url = 'http://vimeo.com'
7
 search_url = base_url + '/search?{query}'
7
 search_url = base_url + '/search?{query}'
8
+url_xpath     = None
9
+content_xpath = None
10
+title_xpath   = None
11
+results_xpath = ''
8
 
12
 
9
-# the cookie set by vime contains all the following values, but only __utma seems to be requiered 
10
-Cookie = {
13
+# the cookie set by vimeo contains all the following values, but only __utma seems to be requiered
14
+cookie = {
11
     #'vuid':'918282893.1027205400'
15
     #'vuid':'918282893.1027205400'
12
     # 'ab_bs':'%7B%223%22%3A279%7D'
16
     # 'ab_bs':'%7B%223%22%3A279%7D'
13
      '__utma':'00000000.000#0000000.0000000000.0000000000.0000000000.0'
17
      '__utma':'00000000.000#0000000.0000000000.0000000000.0000000000.0'
19
 
23
 
20
 def request(query, params):
24
 def request(query, params):
21
     params['url'] = search_url.format(query=urlencode({'q' :query}))
25
     params['url'] = search_url.format(query=urlencode({'q' :query}))
22
-    print params['url']
23
-    params['cookies'] = Cookie
26
+    params['cookies'] = cookie
24
     return params
27
     return params
25
 
28
 
26
 def response(resp):
29
 def response(resp):
27
     results = []
30
     results = []
28
     dom = html.fromstring(resp.text)
31
     dom = html.fromstring(resp.text)
29
-    
32
+
30
     p = HTMLParser()
33
     p = HTMLParser()
31
 
34
 
32
     for result in dom.xpath(results_xpath):
35
     for result in dom.xpath(results_xpath):