From: Roland Häder Date: Tue, 4 Jul 2023 14:49:13 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df17e9049d439f3a0769f6970302266157ecdf90;p=fba.git Continued: - try to "crawl" instances being redirected to --- diff --git a/fba/http/federation.py b/fba/http/federation.py index c7c2fd8..845d46a 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -448,11 +448,20 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str: instances.set_detection_mode(domain, "PLATFORM") elif not domain_helper.is_in_url(domain, response.url): logger.warning("domain='%s' doesn't match response.url='%s', maybe redirect to other domain?", domain, response.url) + + components = urlparse(response.url) + + log.debug("components[]='%s'", type(components)) + if not instances.is_registered(components.netloc): + logger.info("components.netloc='%s' is not registered, adding ...", components.netloc) + fetch_instances(components.netloc, domain, None, "fetch_generator") + message = f"Redirect from domain='{domain}' to response.url='{response.url}'" instances.set_last_error(domain, message) instances.set_software(domain, None) instances.set_detection_mode(domain, None) instances.set_nodeinfo_url(domain, None) + raise requests.exceptions.TooManyRedirects(message) logger.debug("software[]='%s'", type(software))