.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.wikidata.WDURLAttribute Class Reference
+ Inheritance diagram for searx.engines.wikidata.WDURLAttribute:
+ Collaboration diagram for searx.engines.wikidata.WDURLAttribute:

Public Member Functions

 __init__ (self, name, url_id=None, kwargs=None)
 
 get_str (self, result, language)
 
- Public Member Functions inherited from searx.engines.wikidata.WDAttribute
 get_select (self)
 
 get_label (self, language)
 
 get_where (self)
 
 get_wikibase_label (self)
 
 get_group_by (self)
 
 __repr__ (self)
 

Public Attributes

 url_id = url_id
 
 kwargs = kwargs
 
- Public Attributes inherited from searx.engines.wikidata.WDAttribute
 name = name
 

Static Public Attributes

str HTTP_WIKIMEDIA_IMAGE = 'http://commons.wikimedia.org/wiki/Special:FilePath/'
 

Static Private Attributes

str __slots__ = 'url_id', 'kwargs'
 

Detailed Description

Definition at line 591 of file wikidata.py.

Constructor & Destructor Documentation

◆ __init__()

searx.engines.wikidata.WDURLAttribute.__init__ ( self,
name,
url_id = None,
kwargs = None )

Reimplemented from searx.engines.wikidata.WDAttribute.

Reimplemented in searx.engines.wikidata.WDImageAttribute.

Definition at line 597 of file wikidata.py.

597 def __init__(self, name, url_id=None, kwargs=None):
598 super().__init__(name)
599 self.url_id = url_id
600 self.kwargs = kwargs
601

References searx.engines.wikidata.WDURLAttribute.__init__().

Referenced by searx.engines.wikidata.WDURLAttribute.__init__().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ get_str()

searx.engines.wikidata.WDURLAttribute.get_str ( self,
result,
language )

Reimplemented from searx.engines.wikidata.WDAttribute.

Definition at line 602 of file wikidata.py.

602 def get_str(self, result, language):
603 value = result.get(self.name + 's')
604 if self.url_id and value is not None and value != '':
605 value = value.split(',')[0]
606 url_id = self.url_id
607 if value.startswith(WDURLAttribute.HTTP_WIKIMEDIA_IMAGE):
608 value = value[len(WDURLAttribute.HTTP_WIKIMEDIA_IMAGE) :]
609 url_id = 'wikimedia_image'
610 return get_external_url(url_id, value)
611 return value
612
613

References searx.engines.wikidata.WDAmountAttribute.name, searx.engines.wikidata.WDAttribute.name, searx.engines.wikidata.WDDateAttribute.name, searx.engines.wikidata.WDGeoAttribute.name, searx.engines.wikidata.WDLabelAttribute.name, searx.preferences.BooleanChoices.name, searx.search.models.EngineRef.name, and searx.engines.wikidata.WDURLAttribute.url_id.

Member Data Documentation

◆ __slots__

str searx.engines.wikidata.WDURLAttribute.__slots__ = 'url_id', 'kwargs'
staticprivate

Definition at line 595 of file wikidata.py.

◆ HTTP_WIKIMEDIA_IMAGE

str searx.engines.wikidata.WDURLAttribute.HTTP_WIKIMEDIA_IMAGE = 'http://commons.wikimedia.org/wiki/Special:FilePath/'
static

Definition at line 593 of file wikidata.py.

◆ kwargs

searx.engines.wikidata.WDURLAttribute.kwargs = kwargs

Definition at line 600 of file wikidata.py.

◆ url_id

searx.engines.wikidata.WDURLAttribute.url_id = url_id

Definition at line 599 of file wikidata.py.

Referenced by searx.engines.wikidata.WDURLAttribute.get_str().


The documentation for this class was generated from the following file: