def determineFrom(comic_url): """ Return a download module determined by the URL """ scheme, domain, path = web.getUrlComponents(comic_url) if domain == None: ComicError("Invalid URL") for engine_file in getAvailableEngineFiles(): cengine = importlib.import_module(engine_file) if domain in cengine.valid_domains: return cengine raise ComicError("Unknown handler for %s" % domain)
def __ini__(self, url): url = self.validateUrl(url) web.WebResource.__init__(self, url) self.domain = web.getUrlComponents(url, 2)