From efe35aa81ccca0979073d4774bdf1e15e0a09c0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 20 May 2024 14:33:25 +0200 Subject: [PATCH] Continued: - some servers may return '' at the start (position 0), - so if string.find() cannot find that string " dict: ) logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d", response.ok, response.status_code, len(response.text)) - if response.ok and response.status_code == 200 and response.text.strip() != "" and response.text.find(" 0 and domain_helper.is_in_url(domain, response.url.split("#")[0]): + if response.ok and response.status_code == 200 and response.text.strip() != "" and response.text.find("= 0 and domain_helper.is_in_url(domain, response.url.split("#")[0]): # Save cookies logger.debug("Parsing response.text()=%d Bytes ...", len(response.text)) cookies.store(domain, response.cookies.get_dict()) diff --git a/fba/http/federation.py b/fba/http/federation.py index aafef11..d9101c6 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -297,7 +297,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str: response_url = response.url.split("#")[0] logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d,response_url='%s'", response.ok, response.status_code, len(response.text), response_url) - if ((response.ok and response.status_code == 200) or response.status_code == 410) and response.text.find(" 0 and validators.domain(response_url) and domain_helper.is_in_url(domain, response_url): + if ((response.ok and response.status_code == 200) or response.status_code == 410) and response.text.find("= 0 and validators.domain(response_url) and domain_helper.is_in_url(domain, response_url): logger.debug("Parsing response.text()=%d Bytes ...", len(response.text)) doc = bs4.BeautifulSoup(response.text, "html.parser") -- 2.39.5