33def response(resp):
34 results = []
35
36 dom = html.fromstring(resp.text)
37
38 for result in eval_xpath_list(dom, '//table[contains(@class, "table-list")]/tbody//tr'):
39 href = urljoin(url, eval_xpath_getindex(result, './td[contains(@class, "name")]/a[2]/@href', 0))
40 title = extract_text(eval_xpath(result, './td[contains(@class, "name")]/a[2]'))
41 seed = extract_text(eval_xpath(result, './/td[contains(@class, "seeds")]'))
42 leech = extract_text(eval_xpath(result, './/td[contains(@class, "leeches")]'))
43 filesize = extract_text(eval_xpath(result, './/td[contains(@class, "size")]/text()'))
44
45 results.append(
46 {
47 'url': href,
48 'title': title,
49 'seed': seed,
50 'leech': leech,
51 'filesize': filesize,
52 'template': 'torrent.html',
53 }
54 )
55
56 return results