# VERSION: 1.4 # AUTHORS: LightDestory (https://github.com/LightDestory) # CONTRIBUTORS: YoWhatupGee (https://github.com/YoWhatupGee) import re import urllib.parse from helpers import retrieve_url from novaprinter import prettyPrinter class pirateiro(object): url = "https://pirateiro.io/" name = "Pirateiro" supported_categories = { "all": "0", "anime": "2", "games": "3", "movies": "1", "music": "4", "software": "6", "tv": "5", } max_pages = 10 class HTMLParser: def __init__(self, url): self.url = url self.noTorrents = False def feed(self, html): self.noTorrents = False torrents = self.__findTorrents(html) resultSize = len(torrents) if resultSize == 0: self.noTorrents = True return for torrent in range(resultSize): data = { "link": torrents[torrent][0], "name": torrents[torrent][1], "size": torrents[torrent][2], "seeds": torrents[torrent][3], "leech": torrents[torrent][4], "engine_url": self.url, "desc_link": torrents[torrent][5], } prettyPrinter(data) def __findTorrents(self, html): torrents = [] # The site renders the same results twice, as a table and as a mobile # list, so the search is limited to the table rows to avoid duplicates for row in re.findall(r"