added "type" attribute
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
def nyaa_categories(self, b):
|
def nyaa_categories(b):
|
||||||
c = b.replace('/?c=', '')
|
c = b.replace('/?c=', '')
|
||||||
cats = c.split('_')
|
cats = c.split('_')
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ def nyaa_categories(self, b):
|
|||||||
|
|
||||||
return category_name
|
return category_name
|
||||||
|
|
||||||
def parse_nyaa(self, table_rows, limit):
|
def parse_nyaa(table_rows, limit):
|
||||||
if limit == 0:
|
if limit == 0:
|
||||||
limit = len(table_rows)
|
limit = len(table_rows)
|
||||||
|
|
||||||
@@ -89,10 +89,18 @@ def parse_nyaa(self, table_rows, limit):
|
|||||||
if td.text.rstrip():
|
if td.text.rstrip():
|
||||||
block.append(td.text.rstrip())
|
block.append(td.text.rstrip())
|
||||||
|
|
||||||
|
if row.has_attr('class'):
|
||||||
|
if row['class'][0] == 'danger':
|
||||||
|
block.append("remake")
|
||||||
|
elif row['class'][0] == 'success':
|
||||||
|
block.append("trusted")
|
||||||
|
else:
|
||||||
|
block.append("default")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
torrent = {
|
torrent = {
|
||||||
'id': block[1].replace("/view/", ""),
|
'id': block[1].replace("/view/", ""),
|
||||||
'category': nyaa_categories(self, block[0]),
|
'category': nyaa_categories(block[0]),
|
||||||
'url': "http://nyaa.si{}".format(block[1]),
|
'url': "http://nyaa.si{}".format(block[1]),
|
||||||
'name': block[2],
|
'name': block[2],
|
||||||
'download_url': "http://nyaa.si{}".format(block[4]),
|
'download_url': "http://nyaa.si{}".format(block[4]),
|
||||||
@@ -102,6 +110,7 @@ def parse_nyaa(self, table_rows, limit):
|
|||||||
'seeders': block[8],
|
'seeders': block[8],
|
||||||
'leechers': block[9],
|
'leechers': block[9],
|
||||||
'completed_downloads': block[10],
|
'completed_downloads': block[10],
|
||||||
|
'type': block[11],
|
||||||
}
|
}
|
||||||
|
|
||||||
torrents.append(torrent)
|
torrents.append(torrent)
|
||||||
@@ -110,7 +119,7 @@ def parse_nyaa(self, table_rows, limit):
|
|||||||
|
|
||||||
return torrents
|
return torrents
|
||||||
|
|
||||||
def parse_single(self, content):
|
def parse_single(content):
|
||||||
torrent = {}
|
torrent = {}
|
||||||
data = []
|
data = []
|
||||||
torrent_files = []
|
torrent_files = []
|
||||||
@@ -143,7 +152,7 @@ def parse_single(self, content):
|
|||||||
|
|
||||||
return torrent
|
return torrent
|
||||||
|
|
||||||
def parse_sukebei(self, table_rows, limit):
|
def parse_sukebei(table_rows, limit):
|
||||||
if limit == 0:
|
if limit == 0:
|
||||||
limit = len(table_rows)
|
limit = len(table_rows)
|
||||||
|
|
||||||
@@ -164,7 +173,7 @@ def parse_sukebei(self, table_rows, limit):
|
|||||||
try:
|
try:
|
||||||
torrent = {
|
torrent = {
|
||||||
'id': block[1].replace("/view/", ""),
|
'id': block[1].replace("/view/", ""),
|
||||||
'category': sukebei_categories(self, block[0]),
|
'category': sukebei_categories(block[0]),
|
||||||
'url': "http://sukebei.nyaa.si{}".format(block[1]),
|
'url': "http://sukebei.nyaa.si{}".format(block[1]),
|
||||||
'name': block[2],
|
'name': block[2],
|
||||||
'download_url': "http://sukebei.nyaa.si{}".format(
|
'download_url': "http://sukebei.nyaa.si{}".format(
|
||||||
@@ -183,7 +192,7 @@ def parse_sukebei(self, table_rows, limit):
|
|||||||
|
|
||||||
return torrents
|
return torrents
|
||||||
|
|
||||||
def sukebei_categories(self, b):
|
def sukebei_categories(b):
|
||||||
c = b.replace('/?c=', '')
|
c = b.replace('/?c=', '')
|
||||||
cats = c.split('_')
|
cats = c.split('_')
|
||||||
|
|
||||||
@@ -219,7 +228,7 @@ def sukebei_categories(self, b):
|
|||||||
return category_name
|
return category_name
|
||||||
|
|
||||||
# Pantsu Utils
|
# Pantsu Utils
|
||||||
def query_builder(self, q, params):
|
def query_builder(q, params):
|
||||||
available_params = ["category", "page", "limit", "userID", "fromID",
|
available_params = ["category", "page", "limit", "userID", "fromID",
|
||||||
"status", "maxage", "toDate", "fromDate",
|
"status", "maxage", "toDate", "fromDate",
|
||||||
"dateType", "minSize", "maxSize", "sizeType",
|
"dateType", "minSize", "maxSize", "sizeType",
|
||||||
|
|||||||
Reference in New Issue
Block a user