29def response(resp):
30 results = []
31
32 for item in resp.json()['events']:
33 publishedDate = None
34 if item.get('date'):
35 publishedDate = parser.parse(item['date'])
36
37 iframe_src = None
38 for rec in item['recordings']:
39 if rec['mime_type'].startswith('video'):
40 if not iframe_src:
41 iframe_src = rec['recording_url']
42 elif rec['mime_type'] == 'video/mp4':
43
44 iframe_src = rec['recording_url']
45
46 results.append(
47 {
48 'template': 'videos.html',
49 'url': item['frontend_link'],
50 'title': item['title'],
51 'content': item['description'],
52 'thumbnail': item['thumb_url'],
53 'publishedDate': publishedDate,
54 'length': datetime.timedelta(seconds=item['length']),
55 'iframe_src': iframe_src,
56 }
57 )
58
59 return results