From: Roland Häder Date: Tue, 20 Jun 2023 21:11:56 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=db3e1ccfe1698c9f3f55d0d0b4c0757d184ab7bf;p=fba.git Continued: - also check for ' dict: ) # DEBUG: print(f"DEBUG: response.ok='{response.ok}',response.status_code={response.status_code},response.text()={len(response.text)}") - if response.ok and len(response.text) > 0: + if response.ok and response.status_code < 300 and response.text.find(" 0: # Save cookies + # DEBUG: print(f"DEBUG: Parsing response.text()={len(response.text)} Bytes ...") cookies.store(domain, response.cookies.get_dict()) # Parse text diff --git a/fba/federation.py b/fba/federation.py index ec71617..1d15450 100644 --- a/fba/federation.py +++ b/fba/federation.py @@ -401,8 +401,8 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str: response = network.fetch_response(domain, path, network.web_headers, (config.get("connection_timeout"), config.get("read_timeout"))) # DEBUG: print("DEBUG: domain,response.ok,response.status_code,response.text[]:", domain, response.ok, response.status_code, type(response.text)) - if response.ok and response.status_code < 300 and len(response.text) > 0: - # DEBUG: print("DEBUG: Search for :", domain) + if response.ok and response.status_code < 300 and response.text.find(" 0: + # DEBUG: print(f"DEBUG: Parsing response.text()={len(response.text)} Bytes ...") doc = bs4.BeautifulSoup(response.text, "html.parser") # DEBUG: print("DEBUG: doc[]:", type(doc))