.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.ina Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['videos']
 
bool paging = True
 
int page_size = 12
 
str base_url = 'https://www.ina.fr'
 
str search_url = base_url + '/ajax/recherche?{query}&espace=1&sort=pertinence&order=desc&offset={start}&modified=size'
 
str results_xpath = '//div[@id="searchHits"]/div'
 
str url_xpath = './/a/@href'
 
str title_xpath = './/div[contains(@class,"title-bloc-small")]'
 
str content_xpath = './/div[contains(@class,"sous-titre-fonction")]'
 
str thumbnail_xpath = './/img/@data-src'
 
str publishedDate_xpath = './/div[contains(@class,"dateAgenda")]'
 

Detailed Description

 INA (Videos)

Function Documentation

◆ request()

searx.engines.ina.request ( query,
params )

Definition at line 41 of file ina.py.

41def request(query, params):
42 params['url'] = search_url.format(start=params['pageno'] * page_size, query=urlencode({'q': query}))
43 return params
44
45
46# get response from search-request

◆ response()

searx.engines.ina.response ( resp)

Definition at line 47 of file ina.py.

47def response(resp):
48 results = []
49
50 # we get html in a JSON container...
51 dom = html.fromstring(resp.text)
52
53 # parse results
54 for result in eval_xpath_list(dom, results_xpath):
55 url_relative = eval_xpath_getindex(result, url_xpath, 0)
56 url = base_url + url_relative
57 title = unescape(extract_text(eval_xpath(result, title_xpath)))
58 thumbnail = extract_text(eval_xpath(result, thumbnail_xpath))
59 content = extract_text(eval_xpath(result, publishedDate_xpath)) + extract_text(
60 eval_xpath(result, content_xpath)
61 )
62
63 # append result
64 results.append(
65 {
66 'url': url,
67 'title': title,
68 'content': content,
69 'template': 'videos.html',
70 'thumbnail': thumbnail,
71 }
72 )
73
74 # return results
75 return results

Variable Documentation

◆ about

dict searx.engines.ina.about
Initial value:
1= {
2 "website": 'https://www.ina.fr/',
3 "wikidata_id": 'Q1665109',
4 "official_api_documentation": None,
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": 'HTML',
8 "language": 'fr',
9}

Definition at line 12 of file ina.py.

◆ base_url

str searx.engines.ina.base_url = 'https://www.ina.fr'

Definition at line 28 of file ina.py.

◆ categories

list searx.engines.ina.categories = ['videos']

Definition at line 23 of file ina.py.

◆ content_xpath

str searx.engines.ina.content_xpath = './/div[contains(@class,"sous-titre-fonction")]'

Definition at line 35 of file ina.py.

◆ page_size

int searx.engines.ina.page_size = 12

Definition at line 25 of file ina.py.

◆ paging

bool searx.engines.ina.paging = True

Definition at line 24 of file ina.py.

◆ publishedDate_xpath

str searx.engines.ina.publishedDate_xpath = './/div[contains(@class,"dateAgenda")]'

Definition at line 37 of file ina.py.

◆ results_xpath

str searx.engines.ina.results_xpath = '//div[@id="searchHits"]/div'

Definition at line 32 of file ina.py.

◆ search_url

str searx.engines.ina.search_url = base_url + '/ajax/recherche?{query}&espace=1&sort=pertinence&order=desc&offset={start}&modified=size'

Definition at line 29 of file ina.py.

◆ thumbnail_xpath

str searx.engines.ina.thumbnail_xpath = './/img/@data-src'

Definition at line 36 of file ina.py.

◆ title_xpath

str searx.engines.ina.title_xpath = './/div[contains(@class,"title-bloc-small")]'

Definition at line 34 of file ina.py.

◆ url_xpath

str searx.engines.ina.url_xpath = './/a/@href'

Definition at line 33 of file ina.py.