.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
frinkiac.py
Go to the documentation of this file.
1# SPDX-License-Identifier: AGPL-3.0-or-later
2"""
3 Frinkiac (Images)
4"""
5
6from json import loads
7from urllib.parse import urlencode
8
9# about
10about = {
11 "website": 'https://frinkiac.com',
12 "wikidata_id": 'Q24882614',
13 "official_api_documentation": {'url': None, 'comment': 'see https://github.com/MitchellAW/CompuGlobal'},
14 "use_official_api": False,
15 "require_api_key": False,
16 "results": 'JSON',
17}
18
19categories = ['images']
20
21BASE = 'https://frinkiac.com/'
22SEARCH_URL = '{base}api/search?{query}'
23RESULT_URL = '{base}?{query}'
24THUMB_URL = '{base}img/{episode}/{timestamp}/medium.jpg'
25IMAGE_URL = '{base}img/{episode}/{timestamp}.jpg'
26
27
28def request(query, params):
29 params['url'] = SEARCH_URL.format(base=BASE, query=urlencode({'q': query}))
30 return params
31
32
33def response(resp):
34 results = []
35 response_data = loads(resp.text)
36 for result in response_data:
37 episode = result['Episode']
38 timestamp = result['Timestamp']
39
40 results.append(
41 {
42 'template': 'images.html',
43 'url': RESULT_URL.format(base=BASE, query=urlencode({'p': 'caption', 'e': episode, 't': timestamp})),
44 'title': episode,
45 'content': '',
46 'thumbnail_src': THUMB_URL.format(base=BASE, episode=episode, timestamp=timestamp),
47 'img_src': IMAGE_URL.format(base=BASE, episode=episode, timestamp=timestamp),
48 }
49 )
50
51 return results
request(query, params)
Definition frinkiac.py:28