[enh][mod] using image template rendering

This commit is contained in:
asciimoo 2013-10-22 23:34:45 +02:00
parent 31471ed936
commit 3a6d3e3377
3 changed files with 8 additions and 8 deletions

View file

@ -23,6 +23,8 @@ def response(resp):
url = urljoin(base_url, result.attrib.get('href'))
img = result.xpath('.//img')[0]
title = img.attrib.get('alt', '')
content = '<img src="%s" alt="%s" />' % (img.attrib.get('data-defer-src', ''), title)
results.append({'url': url, 'title': title, 'content': content})
img_src = img.attrib.get('data-defer-src')
if not img_src:
continue
results.append({'url': url, 'title': title, 'img_src': img_src, 'template': 'images.html'})
return results