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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['movies']
 
str base_url = "https://www.rottentomatoes.com"
 
str results_xpath = "//search-page-media-row"
 
str url_xpath = "./a[1]/@href"
 
str title_xpath = "./a/img/@alt"
 
str thumbnail_xpath = "./a/img/@src"
 
str release_year_xpath = "concat('From ', string(./@releaseyear))"
 
str score_xpath = "concat('Score: ', string(./@tomatometerscore))"
 
str cast_xpath = "concat('Starring ', string(./@cast))"
 

Detailed Description

RottenTomatoes (movies)

Function Documentation

◆ request()

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

Definition at line 31 of file rottentomatoes.py.

31def request(query, params):
32 params["url"] = f"{base_url}/search?search={quote_plus(query)}"
33 return params
34
35

◆ response()

searx.engines.rottentomatoes.response ( resp)

Definition at line 36 of file rottentomatoes.py.

36def response(resp):
37 results = []
38
39 dom = html.fromstring(resp.text)
40
41 for result in eval_xpath_list(dom, results_xpath):
42 content = []
43 for xpath in (release_year_xpath, score_xpath, cast_xpath):
44 info = extract_text(eval_xpath(result, xpath))
45
46 # a gap in the end means that no data was found
47 if info and info[-1] != " ":
48 content.append(info)
49
50 results.append(
51 {
52 'url': extract_text(eval_xpath(result, url_xpath)),
53 'title': extract_text(eval_xpath(result, title_xpath)),
54 'content': ', '.join(content),
55 'thumbnail': extract_text(eval_xpath(result, thumbnail_xpath)),
56 }
57 )
58
59 return results

Variable Documentation

◆ about

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

Definition at line 10 of file rottentomatoes.py.

◆ base_url

str searx.engines.rottentomatoes.base_url = "https://www.rottentomatoes.com"

Definition at line 20 of file rottentomatoes.py.

◆ cast_xpath

str searx.engines.rottentomatoes.cast_xpath = "concat('Starring ', string(./@cast))"

Definition at line 28 of file rottentomatoes.py.

◆ categories

list searx.engines.rottentomatoes.categories = ['movies']

Definition at line 18 of file rottentomatoes.py.

◆ release_year_xpath

str searx.engines.rottentomatoes.release_year_xpath = "concat('From ', string(./@releaseyear))"

Definition at line 26 of file rottentomatoes.py.

◆ results_xpath

str searx.engines.rottentomatoes.results_xpath = "//search-page-media-row"

Definition at line 22 of file rottentomatoes.py.

◆ score_xpath

str searx.engines.rottentomatoes.score_xpath = "concat('Score: ', string(./@tomatometerscore))"

Definition at line 27 of file rottentomatoes.py.

◆ thumbnail_xpath

str searx.engines.rottentomatoes.thumbnail_xpath = "./a/img/@src"

Definition at line 25 of file rottentomatoes.py.

◆ title_xpath

str searx.engines.rottentomatoes.title_xpath = "./a/img/@alt"

Definition at line 24 of file rottentomatoes.py.

◆ url_xpath

str searx.engines.rottentomatoes.url_xpath = "./a[1]/@href"

Definition at line 23 of file rottentomatoes.py.