forked from zaclys/searxng
		
	[fix] engine torznab - marginal issues reported from linters
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
		
							parent
							
								
									d803df8d89
								
							
						
					
					
						commit
						9fb77065bd
					
				
					 2 changed files with 19 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
# SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
# lint: pylint
 | 
			
		||||
"""Torznab WebAPI
 | 
			
		||||
 | 
			
		||||
A engine that implements the `torznab WebAPI`_.
 | 
			
		||||
| 
						 | 
				
			
			@ -7,9 +8,9 @@ A engine that implements the `torznab WebAPI`_.
 | 
			
		|||
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
from urllib.parse import quote
 | 
			
		||||
from lxml import etree
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
 | 
			
		||||
from searx.exceptions import SearxEngineAPIException
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +18,7 @@ from searx.exceptions import SearxEngineAPIException
 | 
			
		|||
about = {
 | 
			
		||||
    "website": None,
 | 
			
		||||
    "wikidata_id": None,
 | 
			
		||||
    "official_api_documentation": "https://torznab.github.io/spec-1.3-draft/torznab/Specification-v1.3.html#torznab-api-specification",
 | 
			
		||||
    "official_api_documentation": "https://torznab.github.io/spec-1.3-draft",
 | 
			
		||||
    "use_official_api": True,
 | 
			
		||||
    "require_api_key": False,
 | 
			
		||||
    "results": 'XML',
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +106,7 @@ def response(resp):
 | 
			
		|||
            result["publishedDate"] = datetime.strptime(
 | 
			
		||||
                get_property(item, 'pubDate'), '%a, %d %b %Y %H:%M:%S %z')
 | 
			
		||||
        except (ValueError, TypeError) as e:
 | 
			
		||||
            pass
 | 
			
		||||
            logger.debug("ignore exception (publishedDate): %s", e)
 | 
			
		||||
 | 
			
		||||
        result["seed"] = get_torznab_attr(item, 'seeders')
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1271,6 +1271,21 @@ engines:
 | 
			
		|||
    enable_http: true
 | 
			
		||||
    shortcut: tch
 | 
			
		||||
 | 
			
		||||
  # torznab engine lets you query any torznab compatible indexer.  Using this
 | 
			
		||||
  # engine in combination with Jackett (https://github.com/Jackett/Jackett)
 | 
			
		||||
  # opens the possibility to query a lot of public and private indexers directly
 | 
			
		||||
  # from SearXNG.
 | 
			
		||||
  # - name: torznab
 | 
			
		||||
  #   engine: torznab
 | 
			
		||||
  #   shortcut: trz
 | 
			
		||||
  #   base_url: http://localhost:9117/api/v2.0/indexers/all/results/torznab
 | 
			
		||||
  #   enable_http: true  # if using localhost
 | 
			
		||||
  #   api_key: xxxxxxxxxxxxxxx
 | 
			
		||||
  #   # https://github.com/Jackett/Jackett/wiki/Jackett-Categories
 | 
			
		||||
  #   torznab_categories:  # optional
 | 
			
		||||
  #     - 2000
 | 
			
		||||
  #     - 5000
 | 
			
		||||
 | 
			
		||||
  # maybe in a fun category
 | 
			
		||||
  #  - name: uncyclopedia
 | 
			
		||||
  #    engine: mediawiki
 | 
			
		||||
| 
						 | 
				
			
			@ -1654,19 +1669,6 @@ engines:
 | 
			
		|||
      require_api_key: false
 | 
			
		||||
      results: HTML
 | 
			
		||||
 | 
			
		||||
# torznab engine lets you query any torznab compatible indexer.
 | 
			
		||||
# Using this engine in combination with Jackett (https://github.com/Jackett/Jackett)
 | 
			
		||||
# opens the possibility to query a lot of public and private indexers directly from searXNG.
 | 
			
		||||
#  - name: torznab
 | 
			
		||||
#    engine: torznab
 | 
			
		||||
#    shortcut: trz
 | 
			
		||||
#    base_url: http://localhost:9117/api/v2.0/indexers/all/results/torznab
 | 
			
		||||
#    enable_http: true # if using localhost
 | 
			
		||||
#    api_key: xxxxxxxxxxxxxxx
 | 
			
		||||
#    torznab_categories: # optional
 | 
			
		||||
#     - 2000
 | 
			
		||||
#     - 5000
 | 
			
		||||
 | 
			
		||||
# Doku engine lets you access to any Doku wiki instance:
 | 
			
		||||
# A public one or a privete/corporate one.
 | 
			
		||||
#  - name: ubuntuwiki
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue