Browse Source

Add language support
Allow the user to select a language. It must be written in english, and capitalized, ie : English, French, German, Hungarian...

Cqoicebordel 10 years ago
parent
commit
10e4f6f316
2 changed files with 8 additions and 0 deletions
  1. 5 0
      searx/engines/subtitleseeker.py
  2. 3 0
      searx/settings.yml

+ 5 - 0
searx/engines/subtitleseeker.py

@@ -15,6 +15,7 @@ from lxml import html
 # engine dependent config
 # engine dependent config
 categories = ['videos']
 categories = ['videos']
 paging = True
 paging = True
+language = ""
 
 
 # search-url
 # search-url
 url = 'http://www.subtitleseeker.com/'
 url = 'http://www.subtitleseeker.com/'
@@ -41,6 +42,10 @@ def response(resp):
     for result in dom.xpath(results_xpath):
     for result in dom.xpath(results_xpath):
         link = result.xpath(".//a")[0]
         link = result.xpath(".//a")[0]
         href = link.attrib.get('href')
         href = link.attrib.get('href')
+
+        if language is not "":
+            href = href + language + "/"
+
         title = escape(link.xpath(".//text()")[0])
         title = escape(link.xpath(".//text()")[0])
 
 
         content = result.xpath('.//div[contains(@class,"red")]//text()')[0]
         content = result.xpath('.//div[contains(@class,"red")]//text()')[0]

+ 3 - 0
searx/settings.yml

@@ -130,6 +130,9 @@ engines:
   - name : subtitleseeker
   - name : subtitleseeker
     engine : subtitleseeker
     engine : subtitleseeker
     shortcut : ss
     shortcut : ss
+# The language is an option. You can put any language written in english
+# Examples : English, French, German, Hungarian, Chinese...
+#    language : English
 
 
   - name : startpage
   - name : startpage
     engine : startpage
     engine : startpage