33def response(resp):
34 search_res = resp.json()
35 results = []
36
37 for item in search_res:
38 img = 'https://findthatmeme.us-southeast-1.linodeobjects.com/' + item['image_path']
39 thumb = 'https://findthatmeme.us-southeast-1.linodeobjects.com/thumb/' + item.get('thumbnail', '')
40 date = datetime.strptime(item["updated_at"].split("T")[0], "%Y-%m-%d")
41 formatted_date = datetime.utcfromtimestamp(date.timestamp())
42
43 results.append(
44 {
45 'url': item['source_page_url'],
46 'title': item['source_site'],
47 'img_src': img if item['type'] == 'IMAGE' else thumb,
48 'filesize': humanize_bytes(item['meme_file_size']),
49 'publishedDate': formatted_date,
50 'template': 'images.html',
51 }
52 )
53
54 return results