)
# 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("<html") > 0:
# Save cookies
+ # DEBUG: print(f"DEBUG: Parsing response.text()={len(response.text)} Bytes ...")
cookies.store(domain, response.cookies.get_dict())
# Parse text
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 <meta name='generator'>:", domain)
+ if response.ok and response.status_code < 300 and response.text.find("<html") > 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))