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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = []
 
bool paging = True
 
str base_url = "https://www.goodreads.com"
 
str results_xpath = "//table//tr"
 
str thumbnail_xpath = ".//img[contains(@class, 'bookCover')]/@src"
 
str url_xpath = ".//a[contains(@class, 'bookTitle')]/@href"
 
str title_xpath = ".//a[contains(@class, 'bookTitle')]"
 
str author_xpath = ".//a[contains(@class, 'authorName')]"
 
str info_text_xpath = ".//span[contains(@class, 'uitext')]"
 

Detailed Description

Goodreads (books)

Function Documentation

◆ request()

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

Definition at line 31 of file goodreads.py.

31def request(query, params):
32 args = {
33 'q': query,
34 'page': params['pageno'],
35 }
36
37 params['url'] = f"{base_url}/search?{urlencode(args)}"
38 return params
39
40

◆ response()

searx.engines.goodreads.response ( resp)

Definition at line 41 of file goodreads.py.

41def response(resp):
42 results = []
43
44 dom = html.fromstring(resp.text)
45
46 for result in eval_xpath_list(dom, results_xpath):
47 results.append(
48 {
49 'url': base_url + extract_text(eval_xpath(result, url_xpath)),
50 'title': extract_text(eval_xpath(result, title_xpath)),
51 'thumbnail': extract_text(eval_xpath(result, thumbnail_xpath)),
52 'content': extract_text(eval_xpath(result, info_text_xpath)),
53 'metadata': extract_text(eval_xpath(result, author_xpath)),
54 }
55 )
56
57 return results

Variable Documentation

◆ about

dict searx.engines.goodreads.about
Initial value:
1= {
2 'website': 'https://www.goodreads.com',
3 'wikidata_id': 'Q2359213',
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 goodreads.py.

◆ author_xpath

str searx.engines.goodreads.author_xpath = ".//a[contains(@class, 'authorName')]"

Definition at line 27 of file goodreads.py.

◆ base_url

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

Definition at line 21 of file goodreads.py.

◆ categories

list searx.engines.goodreads.categories = []

Definition at line 18 of file goodreads.py.

◆ info_text_xpath

str searx.engines.goodreads.info_text_xpath = ".//span[contains(@class, 'uitext')]"

Definition at line 28 of file goodreads.py.

◆ paging

bool searx.engines.goodreads.paging = True

Definition at line 19 of file goodreads.py.

◆ results_xpath

str searx.engines.goodreads.results_xpath = "//table//tr"

Definition at line 23 of file goodreads.py.

◆ thumbnail_xpath

str searx.engines.goodreads.thumbnail_xpath = ".//img[contains(@class, 'bookCover')]/@src"

Definition at line 24 of file goodreads.py.

◆ title_xpath

str searx.engines.goodreads.title_xpath = ".//a[contains(@class, 'bookTitle')]"

Definition at line 26 of file goodreads.py.

◆ url_xpath

str searx.engines.goodreads.url_xpath = ".//a[contains(@class, 'bookTitle')]/@href"

Definition at line 25 of file goodreads.py.