[perf] torrents.html, files.html: don't parse and re-format filesize
This commit is contained in:
@@ -36,14 +36,11 @@ Implementations
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
from urllib.parse import quote
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from searx.utils import get_torrent_size
|
||||
|
||||
# about
|
||||
about = {
|
||||
"website": 'https://bt4gprx.com',
|
||||
@@ -103,8 +100,6 @@ def response(resp):
|
||||
title = entry.find("title").text
|
||||
link = entry.find("guid").text
|
||||
fullDescription = entry.find("description").text.split('<br>')
|
||||
filesize = fullDescription[1]
|
||||
filesizeParsed = re.split(r"([A-Z]+)", filesize)
|
||||
magnetlink = entry.find("link").text
|
||||
pubDate = entry.find("pubDate").text
|
||||
results.append(
|
||||
@@ -114,7 +109,7 @@ def response(resp):
|
||||
'magnetlink': magnetlink,
|
||||
'seed': 'N/A',
|
||||
'leech': 'N/A',
|
||||
'filesize': get_torrent_size(filesizeParsed[0], filesizeParsed[1]),
|
||||
'filesize': fullDescription[1],
|
||||
'publishedDate': datetime.strptime(pubDate, '%a,%d %b %Y %H:%M:%S %z'),
|
||||
'template': 'torrent.html',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user