diff --git a/nova3/engines/solidtorrents.py b/nova3/engines/solidtorrents.py index 33b9441..5dfccd6 100644 --- a/nova3/engines/solidtorrents.py +++ b/nova3/engines/solidtorrents.py @@ -1,4 +1,4 @@ -# VERSION: 2.2 +# VERSION: 2.3 # AUTHORS: nKlido # LICENSING INFORMATION @@ -23,6 +23,7 @@ from helpers import retrieve_url from novaprinter import prettyPrinter from html.parser import HTMLParser +from datetime import datetime import math @@ -43,6 +44,7 @@ def __init__(self, url): self.parseSeeders = False self.parseLeechers = False self.parseSize = False + self.parseDate = False self.column = 0 self.torrentReady = False self.foundSearchStats = False @@ -59,7 +61,8 @@ def empty_torrent_info(self): 'seeds': '-1', 'leech': '-1', 'engine_url': self.url, - 'desc_link': '' + 'desc_link': '', + 'pub_date': -1, } def handle_starttag(self, tag, attrs): @@ -99,6 +102,9 @@ def handle_starttag(self, tag, attrs): if (self.foundStats and tag == 'font' and self.column == 4): self.parseLeechers = True + if (self.foundStats and tag == 'div' and self.column == 5): + self.parseDate = True + if (self.foundResult and 'dl-magnet' in params.get('class', '') and tag == 'a'): self.torrent_info['link'] = params.get('href') self.foundResult = False @@ -133,6 +139,18 @@ def handle_data(self, data): if (self.parseLeechers): self.torrent_info['leech'] = data self.parseLeechers = False + + if (self.parseDate): + try: + # I chose not to use strptime here because it depends on user's locale + months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', + 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] + [month, day, year] = data.replace(',', '').lower().split() + date = datetime(int(year), int(months.index(month) + 1), int(day)) + self.torrent_info['pub_date'] = int(date.timestamp()) + except Exception: + self.torrent_info['pub_date'] = -1 + self.parseDate = False self.foundStats = False def request(self, searchTerm, category, page=1): diff --git a/nova3/engines/versions.txt b/nova3/engines/versions.txt index 9bf4c79..52c1814 100644 --- a/nova3/engines/versions.txt +++ b/nova3/engines/versions.txt @@ -2,7 +2,7 @@ eztv: 1.14 jackett: 4.0 limetorrents: 4.7 piratebay: 3.3 -solidtorrents: 2.2 +solidtorrents: 2.3 torlock: 2.23 torrentproject: 1.3 torrentscsv: 1.4