diff options
author | Adam Tauber <asciimoo@gmail.com> | 2014-12-24 21:02:26 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2014-12-24 21:02:26 +0100 |
commit | 3b3921fc593e49c12ff79df1d6b15d01fe481bec (patch) | |
tree | fbbfe1252fd4130cfc99cbec1a1fab611f525add /searx/engines/subtitleseeker.py | |
parent | b4f39237a351d35b1b46dcbd33a4a1d94d313d07 (diff) | |
download | searxng-3b3921fc593e49c12ff79df1d6b15d01fe481bec.tar.gz searxng-3b3921fc593e49c12ff79df1d6b15d01fe481bec.zip |
[enh] subtitleseeker: better language handling
Diffstat (limited to 'searx/engines/subtitleseeker.py')
-rw-r--r-- | searx/engines/subtitleseeker.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/searx/engines/subtitleseeker.py b/searx/engines/subtitleseeker.py index 48790a35c..2f1636f59 100644 --- a/searx/engines/subtitleseeker.py +++ b/searx/engines/subtitleseeker.py @@ -11,6 +11,7 @@ from cgi import escape from urllib import quote_plus from lxml import html +from searx.languages import language_codes # engine dependent config categories = ['videos'] @@ -38,13 +39,22 @@ def response(resp): dom = html.fromstring(resp.text) + search_lang = "" + + if resp.search_params['language'] != 'all': + search_lang = [lc[1] + for lc in language_codes + if lc[0][:2] == resp.search_params['language']][0] + # parse results for result in dom.xpath(results_xpath): link = result.xpath(".//a")[0] href = link.attrib.get('href') if language is not "": - href = href + language + "/" + href = href + language + '/' + elif search_lang: + href = href + search_lang + '/' title = escape(link.xpath(".//text()")[0]) |