39def response(resp):
40 results = []
41
42 search_res = loads(resp.text)
43
44
45 for result in search_res.get('data', []):
46 if result['type'] == 'track':
47 title = result['title']
48 url = result['link']
49
50 if url.startswith('http://'):
51 url = 'https' + url[4:]
52
53 content = '{} - {} - {}'.format(result['artist']['name'], result['album']['title'], result['title'])
54
55
56 results.append(
57 {'url': url, 'title': title, 'iframe_src': iframe_src.format(audioid=result['id']), 'content': content}
58 )
59
60
61 return results