Пример #1
0
    def fetch_torrent(self, titles, res):

        history = History()
        downloaded_titles = history.init_downloaded_title()
        computed_titles = self.diff(titles, downloaded_titles)
        print('computed titles: ', computed_titles)

        if not computed_titles:
            print('nothing to download...exit now')
            return

        url_base = 'https://thepiratebay.org'
        for title in computed_titles:
            torrent_page_url = url_base + '/search/' + title + '%20' + res + '/0/99/207'
            print(torrent_page_url)

            history = History()
            history.add_downloaded_title(title)
            time.sleep(1)

            self.invoke_transmission(title, torrent_page_url)
            time.sleep(5)