def copy_magnet(self, link): """Copy magnetic link to clipboard.""" from torrench.Torrench import Torrench tr = Torrench() if tr.check_copy(): try: pyperclip.copy(link) print("(Magnetic link copied to clipboard)") except pyperclip.exceptions.PyperclipException as e: print("(Unable to copy magnetic link to clipboard. Is [xclip] installed?)") print("(See logs for details)") self.logger.error(e)
def copy_magnet(self, link): """Copy magnetic link to clipboard. This method is different from copylink_clipboard(). This method handles the --copy argument. If --copy argument is supplied, magnetic link is copied to clipboard. """ from torrench.Torrench import Torrench tr = Torrench() if tr.check_copy(): try: pyperclip.copy(link) print("(Magnetic link copied to clipboard)") except Exception as e: print("(Unable to copy magnetic link to clipboard. Is [xclip] installed?)") print("(See logs for details)") self.logger.error(e) else: print("(use --copy to copy magnet to clipboard)")
elif args.index == 'rarbg': client = rarbg return client.cross_site(args.query, 1) def determine_best_result(results): # ensure the actual name of return results[0] if __name__ == '__main__': if args.index not in INDEX_PROVIDERS: log.error('%s is not a valid torrent indexer' % args.index) sys.exit(1) tr = Torrench() tr.input_title = args.query tr.page_limit = 1 result = run_query() result.proxy = 'https://thepiratebay.org' result.get_html() result.parse_html() torrents = [] for index, record in enumerate(result.masterlist_crossite): magnet = result.mapper[index][1] record.append(magnet) t = Torrent(*record) log.debug("{} size: {} ratio: {}".format(t.title, t.size, t.ratio)) log.debug(t.magnet)