39def response(resp):
40 results = []
41 xmldom = etree.fromstring(resp.content)
42 xmlsearchresult = eval_xpath_getindex(xmldom, '//data', 0)
43 dom = html.fragment_fromstring(xmlsearchresult.text, create_parent='div')
44 for link in eval_xpath_list(dom, '//a'):
45 url = urljoin(base_url, link.attrib.get('href'))
46 title = extract_text(link)
47 thumbnail_src = urljoin(
48 gallery_url, (eval_xpath_getindex(link, './/img', 0).attrib['src']).replace(base_url, '')
49 )
50
51 results.append(
52 {
53 'url': url,
54 'title': title,
55 'img_src': thumbnail_src,
56 'content': '',
57 'thumbnail_src': thumbnail_src,
58 'template': 'images.html',
59 }
60 )
61
62
63 return results