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

Functions

 request (query, params)
 
 response (resp)
 
 response_movies (resp)
 
 response_apps (resp)
 

Variables

dict about
 
bool send_accept_language_header = True
 
 play_categ = None
 
str base_url = 'https://play.google.com'
 
str search_url = base_url + "/store/search?{query}&c={play_categ}"
 

Detailed Description

Google Play Apps & Google Play Movies

Function Documentation

◆ request()

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

Definition at line 30 of file google_play.py.

30def request(query, params):
31
32 if play_categ not in ('movies', 'apps'):
33 raise ValueError(f"unknown google play category: {play_categ}")
34
35 params["url"] = search_url.format(
36 query=urlencode({"q": query}),
37 play_categ=play_categ,
38 )
39 params['cookies']['CONSENT'] = "YES+"
40
41 return params
42
43

◆ response()

searx.engines.google_play.response ( resp)

Definition at line 44 of file google_play.py.

44def response(resp):
45
46 if play_categ == 'movies':
47 return response_movies(resp)
48 if play_categ == 'apps':
49 return response_apps(resp)
50
51 raise ValueError(f"Unsupported play category: {play_categ}")
52
53

References searx.engines.google_play.response_apps(), and searx.engines.google_play.response_movies().

+ Here is the call graph for this function:

◆ response_apps()

searx.engines.google_play.response_apps ( resp)

Definition at line 81 of file google_play.py.

81def response_apps(resp):
82
83 results = []
84 dom = html.fromstring(resp.text)
85
86 if eval_xpath(dom, '//div[@class="v6DsQb"]'):
87 return []
88
89 spot = eval_xpath_getindex(dom, '//div[@class="ipRz4"]', 0, None)
90 if spot is not None:
91 url = extract_url(eval_xpath(spot, './a[@class="Qfxief"]/@href'), search_url)
92 title = extract_text(eval_xpath(spot, './/div[@class="vWM94c"]'))
93 content = extract_text(eval_xpath(spot, './/div[@class="LbQbAe"]'))
94 img = extract_text(eval_xpath(spot, './/img[@class="T75of bzqKMd"]/@src'))
95
96 results.append({"url": url, "title": title, "content": content, "img_src": img})
97
98 more = eval_xpath_list(dom, '//c-wiz[@jsrenderer="RBsfwb"]//div[@role="listitem"]', min_len=1)
99 for result in more:
100 url = extract_url(eval_xpath(result, ".//a/@href"), search_url)
101 title = extract_text(eval_xpath(result, './/span[@class="DdYX5"]'))
102 content = extract_text(eval_xpath(result, './/span[@class="wMUdtb"]'))
103 img = extract_text(
104 eval_xpath(
105 result,
106 './/img[@class="T75of stzEZd" or @class="T75of etjhNc Q8CSx "]/@src',
107 )
108 )
109
110 results.append({"url": url, "title": title, "content": content, "img_src": img})
111
112 for suggestion in eval_xpath_list(dom, '//c-wiz[@jsrenderer="qyd4Kb"]//div[@class="ULeU3b neq64b"]'):
113 results.append({"suggestion": extract_text(eval_xpath(suggestion, './/div[@class="Epkrse "]'))})
114
115 return results

Referenced by searx.engines.google_play.response().

+ Here is the caller graph for this function:

◆ response_movies()

searx.engines.google_play.response_movies ( resp)

Definition at line 54 of file google_play.py.

54def response_movies(resp):
55
56 results = []
57 dom = html.fromstring(resp.text)
58
59 for section in eval_xpath(dom, '//c-wiz/section/header/..'):
60 sec_name = extract_text(eval_xpath(section, './header'))
61 for item in eval_xpath(section, './/a'):
62 url = base_url + item.get('href')
63 div_1, div_2 = eval_xpath(item, './div')[:2]
64 title = extract_text(eval_xpath(div_2, './div[@title]'))
65 metadata = extract_text(eval_xpath(div_2, './div[@class]'))
66 img = eval_xpath(div_1, './/img')[0]
67 thumbnail = img.get('src')
68 results.append(
69 {
70 "url": url,
71 "title": title,
72 "content": sec_name,
73 "thumbnail": thumbnail,
74 'metadata': metadata,
75 'template': 'videos.html',
76 }
77 )
78 return results
79
80

Referenced by searx.engines.google_play.response().

+ Here is the caller graph for this function:

Variable Documentation

◆ about

dict searx.engines.google_play.about
Initial value:
1= {
2 "website": "https://play.google.com/",
3 "wikidata_id": "Q79576",
4 "use_official_api": False,
5 "require_api_key": False,
6 "results": "HTML",
7}

Definition at line 15 of file google_play.py.

◆ base_url

str searx.engines.google_play.base_url = 'https://play.google.com'

Definition at line 26 of file google_play.py.

◆ play_categ

searx.engines.google_play.play_categ = None

Definition at line 25 of file google_play.py.

◆ search_url

str searx.engines.google_play.search_url = base_url + "/store/search?{query}&c={play_categ}"

Definition at line 27 of file google_play.py.

◆ send_accept_language_header

bool searx.engines.google_play.send_accept_language_header = True

Definition at line 23 of file google_play.py.