import re from module.plugins.internal.SimpleCrypter import SimpleCrypter from module.plugins.internal.misc import uniqify class ImgurCom(SimpleCrypter): __name__ = "ImgurCom" __type__ = "crypter" __version__ = "0.55" __status__ = "testing" __pattern__ = r'https?://(?:www\.|m\.)?imgur\.com/(a|gallery|)/?\w{5,7}' __config__ = [("activated" , "bool" , "Activated" , True ), ("use_premium" , "bool" , "Use premium account if available" , True ), ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Imgur.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com")] NAME_PATTERN = r'(?P.+?) - Imgur' LINK_PATTERN = r'i\.imgur\.com/\w{7}s?\.(?:jpeg|jpg|png|gif|apng)' def get_links(self): f = lambda url: "http://" + re.sub(r'(\w{7})s\.', r'\1.', url) return uniqify(map(f, re.findall(self.LINK_PATTERN, self.data)))