#19 fixed, need to be tested
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Module utils
|
||||
'''
|
||||
|
||||
class Utils():
|
||||
class Utils:
|
||||
|
||||
def nyaa_categories(b):
|
||||
c = b.replace('/?c=', '')
|
||||
@@ -106,6 +106,37 @@ class Utils():
|
||||
|
||||
return torrents
|
||||
|
||||
def parse_single(content):
|
||||
torrent = {}
|
||||
data = []
|
||||
torrent_files = []
|
||||
|
||||
for row in content[0].find_all('div', {'class': 'row'}):
|
||||
for div in row.find_all('div', {'class': 'col-md-5'}):
|
||||
data.append(div.text.replace("\n", ""))
|
||||
|
||||
files = content[2].find('div', {'class', 'torrent-file-list'}).find_all('li')
|
||||
|
||||
for file in files:
|
||||
torrent_files.append(file.text)
|
||||
|
||||
|
||||
torrent['title'] = content[0].find('h3', {"class": "panel-title"}).text.replace("\n", "")
|
||||
torrent['category'] = data[0]
|
||||
torrent['uploader'] = data[2]
|
||||
torrent['uploader_profile'] = "https://nyaa.si/user/{}".format(data[2])
|
||||
torrent['website'] = data[4]
|
||||
torrent['size'] = data[6]
|
||||
torrent['date'] = data[1]
|
||||
torrent['seeders'] = data[3]
|
||||
torrent['leechers'] = data[5]
|
||||
torrent['completed'] = data[7]
|
||||
torrent['hash'] = data[8]
|
||||
torrent['description'] = content[1].find('div', {'id': 'torrent-description'}).text
|
||||
torrent['files'] = torrent_files
|
||||
|
||||
return torrent
|
||||
|
||||
def query_builder(q, params):
|
||||
available_params = ["category", "page", "limit", "userID", "fromID", "status", "maxage", "toDate", "fromDate",\
|
||||
"dateType", "minSize", "maxSize", "sizeType", "sort", "order", "lang"]
|
||||
|
||||
Reference in New Issue
Block a user