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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
bool paging = True
 
list categories = ['images']
 
str base_url = "https://www.pixiv.net/ajax/search/illustrations"
 
list pixiv_image_proxies = []
 

Detailed Description

Pixiv (images)

Function Documentation

◆ request()

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

Definition at line 26 of file pixiv.py.

26def request(query, params):
27 query_params = {
28 "word": query,
29 "order": "date_d",
30 "mode": "all",
31 "p": params["pageno"],
32 "s_mode": "s_tag_full",
33 "type": "illust_and_ugoira",
34 "lang": "en",
35 }
36
37 params["url"] = f"{base_url}/{query}?{urlencode(query_params)}"
38
39 return params
40
41

◆ response()

searx.engines.pixiv.response ( resp)

Definition at line 42 of file pixiv.py.

42def response(resp):
43 results = []
44 data = resp.json()
45
46 for item in data["body"]["illust"]["data"]:
47
48 image_url = item["url"]
49 pixiv_proxy = random.choice(pixiv_image_proxies)
50 proxy_image_url = image_url.replace("https://i.pximg.net", pixiv_proxy)
51 proxy_full_image_url = (
52 proxy_image_url.replace("/c/250x250_80_a2/", "/")
53 .replace("_square1200.jpg", "_master1200.jpg")
54 .replace("custom-thumb", "img-master")
55 .replace("_custom1200.jpg", "_master1200.jpg")
56 )
57
58 results.append(
59 {
60 "title": item.get("title"),
61 "url": proxy_full_image_url,
62 'content': item.get('alt'),
63 "author": f"{item.get('userName')} (ID: {item.get('userId')})",
64 "img_src": proxy_full_image_url,
65 "thumbnail_src": proxy_image_url,
66 "source": 'pixiv.net',
67 "template": "images.html",
68 }
69 )
70
71 return results

Variable Documentation

◆ about

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

Definition at line 8 of file pixiv.py.

◆ base_url

str searx.engines.pixiv.base_url = "https://www.pixiv.net/ajax/search/illustrations"

Definition at line 22 of file pixiv.py.

◆ categories

list searx.engines.pixiv.categories = ['images']

Definition at line 19 of file pixiv.py.

◆ paging

bool searx.engines.pixiv.paging = True

Definition at line 18 of file pixiv.py.

◆ pixiv_image_proxies

list searx.engines.pixiv.pixiv_image_proxies = []

Definition at line 23 of file pixiv.py.