Removing the Utils class.
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import requests
|
||||
import urllib.parse
|
||||
from bs4 import BeautifulSoup
|
||||
from NyaaPy.utils import Utils
|
||||
|
||||
utils = Utils()
|
||||
|
||||
from NyaaPy.utils import utils
|
||||
|
||||
class Nyaa:
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import requests
|
||||
from NyaaPy.utils import Utils
|
||||
|
||||
utils = Utils()
|
||||
|
||||
from NyaaPy.utils import utils
|
||||
|
||||
class Pantsu:
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from NyaaPy.utils import Utils as utils
|
||||
|
||||
from NyaaPy.utils import utils
|
||||
|
||||
class SukebeiNyaa:
|
||||
def search(self, keyword, **kwargs):
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
import re
|
||||
|
||||
|
||||
class Utils:
|
||||
def nyaa_categories(self, b):
|
||||
def nyaa_categories(self, b):
|
||||
c = b.replace('/?c=', '')
|
||||
cats = c.split('_')
|
||||
|
||||
@@ -71,7 +69,7 @@ class Utils:
|
||||
|
||||
return category_name
|
||||
|
||||
def parse_nyaa(self, table_rows, limit):
|
||||
def parse_nyaa(self, table_rows, limit):
|
||||
if limit == 0:
|
||||
limit = len(table_rows)
|
||||
|
||||
@@ -94,7 +92,7 @@ class Utils:
|
||||
try:
|
||||
torrent = {
|
||||
'id': block[1].replace("/view/", ""),
|
||||
'category': Utils.nyaa_categories(self, block[0]),
|
||||
'category': nyaa_categories(self, block[0]),
|
||||
'url': "http://nyaa.si{}".format(block[1]),
|
||||
'name': block[2],
|
||||
'download_url': "http://nyaa.si{}".format(block[4]),
|
||||
@@ -112,7 +110,7 @@ class Utils:
|
||||
|
||||
return torrents
|
||||
|
||||
def parse_single(self, content):
|
||||
def parse_single(self, content):
|
||||
torrent = {}
|
||||
data = []
|
||||
torrent_files = []
|
||||
@@ -145,7 +143,7 @@ class Utils:
|
||||
|
||||
return torrent
|
||||
|
||||
def parse_sukebei(self, table_rows, limit):
|
||||
def parse_sukebei(self, table_rows, limit):
|
||||
if limit == 0:
|
||||
limit = len(table_rows)
|
||||
|
||||
@@ -166,7 +164,7 @@ class Utils:
|
||||
try:
|
||||
torrent = {
|
||||
'id': block[1].replace("/view/", ""),
|
||||
'category': Utils.sukebei_categories(self, block[0]),
|
||||
'category': sukebei_categories(self, block[0]),
|
||||
'url': "http://sukebei.nyaa.si{}".format(block[1]),
|
||||
'name': block[2],
|
||||
'download_url': "http://sukebei.nyaa.si{}".format(
|
||||
@@ -183,7 +181,7 @@ class Utils:
|
||||
|
||||
return torrents
|
||||
|
||||
def sukebei_categories(self, b):
|
||||
def sukebei_categories(self, b):
|
||||
c = b.replace('/?c=', '')
|
||||
cats = c.split('_')
|
||||
|
||||
@@ -218,8 +216,8 @@ class Utils:
|
||||
|
||||
return category_name
|
||||
|
||||
# Pantsu Utils
|
||||
def query_builder(self, q, params):
|
||||
# Pantsu Utils
|
||||
def query_builder(self, q, params):
|
||||
available_params = ["category", "page", "limit", "userID", "fromID",
|
||||
"status", "maxage", "toDate", "fromDate",
|
||||
"dateType", "minSize", "maxSize", "sizeType",
|
||||
|
||||
Reference in New Issue
Block a user