|
@@ -28,16 +28,18 @@ xpath_title = './/td[3]/a[last()]'
|
28
|
28
|
xpath_torrent_links = './/td[3]/a'
|
29
|
29
|
xpath_filesize = './/td[4]/text()'
|
30
|
30
|
|
|
31
|
+
|
31
|
32
|
def request(query, params):
|
32
|
33
|
query = urlencode({'keyword': query})
|
33
|
34
|
params['url'] = search_url.format(query=query, offset=params['pageno'])
|
34
|
35
|
return params
|
35
|
36
|
|
|
37
|
+
|
36
|
38
|
def response(resp):
|
37
|
39
|
results = []
|
38
|
40
|
dom = html.fromstring(resp.text)
|
39
|
41
|
print(resp.text)
|
40
|
|
- for result in dom.xpath(xpath_results):
|
|
42
|
+ for result in dom.xpath(xpath_results):
|
41
|
43
|
# defaults
|
42
|
44
|
filesize = 0
|
43
|
45
|
magnet_link = "magnet:?xt=urn:btih:{}&tr=http://tracker.acgsou.com:2710/announce"
|
|
@@ -59,12 +61,12 @@ def response(resp):
|
59
|
61
|
filesize = filesize_info[:-2]
|
60
|
62
|
filesize_multiplier = filesize_info[-2:]
|
61
|
63
|
filesize = get_torrent_size(filesize, filesize_multiplier)
|
62
|
|
- except :
|
|
64
|
+ except:
|
63
|
65
|
pass
|
64
|
66
|
#I didn't add download/seed/leech count since as I figured out they are generated randowmly everytime
|
65
|
67
|
content = 'Category: "{category}".'
|
66
|
68
|
content = content.format(category=category)
|
67
|
|
-
|
|
69
|
+
|
68
|
70
|
results.append({'url': href,
|
69
|
71
|
'title': title,
|
70
|
72
|
'content': content,
|