60 dom = html.fromstring(resp.text)
62 for result
in dom.xpath(xpath_results):
70 category = eval_xpath_getindex(result, xpath_category, 0,
'')
72 category = category.attrib.get(
'title')
75 page_a = result.xpath(xpath_title)[0]
76 title = extract_text(page_a)
79 href = base_url + page_a.attrib.get(
'href')
81 for link
in result.xpath(xpath_torrent_links):
82 url = link.attrib.get(
'href')
91 seed = int_or_zero(result.xpath(xpath_seeds))
94 leech = int_or_zero(result.xpath(xpath_leeches))
97 downloads = int_or_zero(result.xpath(xpath_downloads))
101 filesize = eval_xpath_getindex(result, xpath_filesize, 0,
'')
104 content =
'Category: "{category}". Downloaded {downloads} times.'
105 content = content.format(category=category, downloads=downloads)
114 'filesize': filesize,
115 'torrentfile': torrent_link,
116 'magnetlink': magnet_link,
117 'template':
'torrent.html',