Skip to content

Commit

Permalink
Added published date to torlock
Browse files Browse the repository at this point in the history
  • Loading branch information
ducalex committed Jul 2, 2024
1 parent f42e3e9 commit e1ac066
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions nova3/engines/torlock.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#VERSION: 2.22
#VERSION: 2.23
# AUTHORS: Douman ([email protected])
# CONTRIBUTORS: Diego de las Heras ([email protected])

from re import compile as re_compile
from html.parser import HTMLParser
from datetime import datetime, timedelta

from novaprinter import prettyPrinter
from helpers import retrieve_url, download_file
Expand Down Expand Up @@ -34,7 +35,8 @@ def __init__(self, url):
self.item_bad = False # set to True for malicious links
self.current_item = None # dict for found item
self.item_name = None # key's name in current_item dict
self.parser_class = {"ts": "size",
self.parser_class = {"td": "pub_date",
"ts": "size",
"tul": "seeds",
"tdl": "leech"}

Expand Down Expand Up @@ -76,6 +78,18 @@ def handle_endtag(self, tag):
elif self.item_found and tag == "tr":
self.item_found = False
if not self.item_bad:
try:
# Date seems like it can be Today, Yesterday, or M/D/YYYY (Timezone unknown)
if self.current_item["pub_date"] == "Today":
date = datetime.now()
elif self.current_item["pub_date"] == "Yesterday":
date = datetime.now() - timedelta(days=1)
else:
date = datetime.strptime(self.current_item["pub_date"], '%m/%d/%Y')
date = date.replace(hour=0, minute=0, second=0, microsecond=0) # We have no time info
self.current_item["pub_date"] = int(date.timestamp())
except:
self.current_item["pub_date"] = -1
prettyPrinter(self.current_item)
self.current_item = {}

Expand Down
2 changes: 1 addition & 1 deletion nova3/engines/versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ jackett: 4.0
limetorrents: 4.7
piratebay: 3.2
solidtorrents: 2.1
torlock: 2.22
torlock: 2.23
torrentproject: 1.2
torrentscsv: 1.2

0 comments on commit e1ac066

Please sign in to comment.