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