36 json_results = loads(resp.text)[
'data']
38 for result
in json_results[
'posts']:
39 result_type = result[
'type']
42 if result[
'images'][
'image700'][
'height'] > 400:
43 thumbnail = result[
'images'][
'imageFbThumbnail'][
'url']
45 thumbnail = result[
'images'][
'image700'][
'url']
47 if result_type ==
'Photo':
50 'template':
'images.html',
52 'title': result[
'title'],
53 'content': result[
'description'],
54 'publishedDate': datetime.utcfromtimestamp(result[
'creationTs']),
55 'img_src': result[
'images'][
'image700'][
'url'],
56 'thumbnail_src': thumbnail,
59 elif result_type ==
'Animated':
62 'template':
'videos.html',
64 'title': result[
'title'],
65 'content': result[
'description'],
66 'publishedDate': datetime.utcfromtimestamp(result[
'creationTs']),
67 'thumbnail': thumbnail,
68 'iframe_src': result[
'images'].get(
'image460sv', {}).get(
'url'),
72 if 'tags' in json_results:
73 for suggestion
in json_results[
'tags']:
74 results.append({
'suggestion': suggestion[
'key']})