]> git.mxchange.org Git - fba.git/blobdiff - fba/http/federation.py
Continued:
[fba.git] / fba / http / federation.py
index 46c1da60d70966f45592c250fe21026e0c883d6c..50f66c37eb0ccea179e207a05010d11d213ed54c 100644 (file)
@@ -262,7 +262,6 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
     elif path == "":
         raise ValueError("Parameter 'path' is empty")
 
-    logger.debug("domain='%s',path='%s' - CALLED!", domain, path)
     software = None
 
     logger.debug("Fetching path='%s' from domain='%s' ...", path, domain)
@@ -286,7 +285,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
         app_name  = doc.find("meta", {"name"    : "application-name"})
 
         logger.debug("generator[]='%s',site_name[]='%s',platform[]='%s',app_name[]='%s'", type(generator), type(site_name), type(platform), type(app_name))
-        if isinstance(platform, bs4.element.Tag) and isinstance(platform.get("content"), str):
+        if isinstance(platform, bs4.element.Tag) and isinstance(platform.get("content"), str) and platform.get("content") != "":
             logger.debug("Found property=og:platform, domain='%s'", domain)
             software = tidyup.domain(platform.get("content"))
 
@@ -294,7 +293,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
             if software is not None and software != "":
                 logger.debug("domain='%s' has og:platform='%s' - Setting detection_mode=PLATFORM ...", domain, software)
                 instances.set_detection_mode(domain, "PLATFORM")
-        elif isinstance(generator, bs4.element.Tag) and isinstance(generator.get("content"), str):
+        elif isinstance(generator, bs4.element.Tag) and isinstance(generator.get("content"), str) and generator.get("content") != "":
             logger.debug("Found generator meta tag: domain='%s'", domain)
             software = tidyup.domain(generator.get("content"))
 
@@ -302,7 +301,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
             if software is not None and software != "":
                 logger.info("domain='%s' is generated by software='%s' - Setting detection_mode=GENERATOR ...", domain, software)
                 instances.set_detection_mode(domain, "GENERATOR")
-        elif isinstance(app_name, bs4.element.Tag) and isinstance(app_name.get("content"), str):
+        elif isinstance(app_name, bs4.element.Tag) and isinstance(app_name.get("content"), str) and app_name.get("content") != "":
             logger.debug("Found property=og:app_name, domain='%s'", domain)
             software = tidyup.domain(app_name.get("content"))
 
@@ -310,7 +309,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
             if software is not None and software != "":
                 logger.debug("domain='%s' has application-name='%s' - Setting detection_mode=app_name ...", domain, software)
                 instances.set_detection_mode(domain, "APP_NAME")
-        elif isinstance(site_name, bs4.element.Tag) and isinstance(site_name.get("content"), str):
+        elif isinstance(site_name, bs4.element.Tag) and isinstance(site_name.get("content"), str) and site_name.get("content") != "":
             logger.debug("Found property=og:site_name, domain='%s'", domain)
             software = tidyup.domain(site_name.get("content"))
 
@@ -427,7 +426,7 @@ def determine_software(domain: str, path: str = None) -> str:
         logger.debug("Generator for domain='%s' is: '%s'", domain, software)
 
     logger.debug("software[%s]='%s'", type(software), software)
-    if software is None:
+    if software is None or software == "":
         logger.debug("Returning None - EXIT!")
         return None