# VERSION: 1 # AUTHORS: Golyb-q import sys import re import time from urllib.parse import quote from novaprinter import prettyPrinter from helpers import retrieve_url import threading class torrentmac(object): url = 'https://www.torrentmac.net/' name = 'torrentmac.net' supported_categories = {'all': ''} def get_response(self, link): try: response = retrieve_url(link) except Exception as e: response = "error" print(f"link|ERROR: ({repr(e)}) {link}|0|0|0||{link}") return response def print_torrent_info(self, link, name, size, desc_link): result = { 'link': link, 'name': name, 'size': size, 'seeds': '0', 'leech': '0', 'engine_url': self.url, 'desc_link': desc_link } prettyPrinter(result) def load_torrent_info(self, link): max_attempts = 20 attempt = 1 while attempt <= max_attempts: response = self.get_response(link) if response: break time.sleep(3) attempt += 1 torrent_pattern = re.compile(r'') name_pattern = re.compile(r'