on master help sign in
SubtitleSeeker Engine

Add the subtitleseeker engine.

commit550232fc21ff2c3ae9a5de3d8b999de66c96171c authorCqoicebordel <Cqoicebordel@users.noreply.github.com> dateMon 22 Dec 2014, 01:00 (12 years ago) parent2e41bfc
2 files changed+63
searx/engines/subtitleseeker.py+59 searx/settings.yml+4
searx/engines/subtitleseeker.pynew file+59
@@ -0,0 +1,59 @@
1+## Subtitleseeker (Video)
2+#
3+# @website http://www.subtitleseeker.com
4+# @provide-api no
5+#
6+# @using-api no
7+# @results HTML
8+# @stable no (HTML can change)
9+# @parse url, title, content
10+
11+from cgi import escape
12+from urllib import quote_plus
13+from lxml import html
14+
15+# engine dependent config
16+categories = ['videos']
17+paging = True
18+
19+# search-url
20+url = 'http://www.subtitleseeker.com/'
21+search_url = url+'search/TITLES/{query}&p={pageno}'
22+
23+# specific xpath variables
24+results_xpath = '//div[@class="boxRows"]'
25+
26+
27+# do search-request
28+def request(query, params):
29+ params['url'] = search_url.format(query=quote_plus(query),
30+ pageno=params['pageno'])
31+ return params
32+
33+
34+# get response from search-request
35+def response(resp):
36+ results = []
37+
38+ dom = html.fromstring(resp.text)
39+
40+ # parse results
41+ for result in dom.xpath(results_xpath):
42+ link = result.xpath(".//a")[0]
43+ href = link.attrib.get('href')
44+ title = escape(link.xpath(".//text()")[0])
45+
46+ content = result.xpath('.//div[contains(@class,"red")]//text()')[0]
47+ content = content + " - "
48+ content = content + html.tostring(result.xpath('.//div[contains(@class,"grey-web")]')[0], method='text')
49+
50+ if result.xpath(".//span") != []:
51+ content = content + " - (" + result.xpath(".//span//text()")[0].strip() + ")"
52+
53+ # append result
54+ results.append({'url': href,
55+ 'title': title,
56+ 'content': escape(content)})
57+
58+ # return results
59+ return results
searx/settings.yml+4
@@ -127,6 +127,10 @@ engines:
127127 engine : searchcode_code
128128 shortcut : scc
129129
130+ - name : subtitleseeker
131+ engine : subtitleseeker
132+ shortcut : ss
133+
130134 - name : startpage
131135 engine : startpage
132136 shortcut : sp