61 dom = html.fromstring(resp.text)
63 for result
in dom.xpath(xpath_results):
71 category = eval_xpath_getindex(result, xpath_category, 0,
'')
73 category = category.attrib.get(
'title')
76 page_a = result.xpath(xpath_title)[0]
77 title = extract_text(page_a)
80 href = base_url + page_a.attrib.get(
'href')
82 for link
in result.xpath(xpath_torrent_links):
83 url = link.attrib.get(
'href')
92 seed = int_or_zero(result.xpath(xpath_seeds))
95 leech = int_or_zero(result.xpath(xpath_leeches))
98 downloads = int_or_zero(result.xpath(xpath_downloads))
103 filesize_info = eval_xpath_getindex(result, xpath_filesize, 0,
'')
105 filesize_info = result.xpath(xpath_filesize)[0]
106 filesize = get_torrent_size(*filesize_info.split())
109 content =
'Category: "{category}". Downloaded {downloads} times.'
110 content = content.format(category=category, downloads=downloads)
119 'filesize': filesize,
120 'torrentfile': torrent_link,
121 'magnetlink': magnet_link,
122 'template':
'torrent.html',