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