)
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("<html") > 0 and domain_helper.is_in_url(domain, response.url):
+ if response.ok and response.status_code == 200 and response.text.strip() != "" and response.text.find("<html") > 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())
if tag is not None:
logger.debug("Adding CSRF token='%s' for domain='%s'", tag["content"], domain)
reqheaders["X-CSRF-Token"] = tag["content"]
- elif not domain_helper.is_in_url(domain, response.url):
+ elif not domain_helper.is_in_url(domain, response.url.split("#")[0]):
logger.warning("domain='%s' doesn't match with response.url='%s', maybe redirect to other domain?", domain, response.url)
message = f"Redirect from domain='{domain}' to response.url='{response.url}'"
)
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) or response.status_code == 410) and response.text.find("<html") > 0 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("<html") > 0 and domain_helper.is_in_url(domain, response.url.split("#")[0]):
logger.debug("Parsing response.text()=%d Bytes ...", len(response.text))
doc = bs4.BeautifulSoup(response.text, "html.parser")
if software is not None and software != "":
logger.debug("domain='%s' has og:site_name='%s' - Setting detection_mode=SITE_NAME ...", domain, software)
instances.set_detection_mode(domain, "SITE_NAME")
- elif not domain_helper.is_in_url(domain, response.url):
+ elif not domain_helper.is_in_url(domain, response.url.split("#")[0]):
logger.warning("domain='%s' doesn't match response.url='%s', maybe redirect to other domain?", domain, response.url)
components = urlparse(response.url)
block_tag = None
try:
- logger.debug("Fetching friendica blocks from domain='%s'", domain)
+ logger.debug("Fetching friendica blocks from domain='%s' ...", domain)
raw = network.fetch_response(
domain,
"/friendica",
for line in rows:
logger.debug("line='%s'", line)
blocked = line.find_all("td")[0].text
- logger.debug("blocked='%s'", blocked)
+ reason = line.find_all("td")[1].text
+ logger.debug("blocked='%s',reason='%s' - BEFORE!", blocked, reason)
blocked = tidyup.domain(blocked) if blocked != "" else None
- reason = tidyup.reason(line.find_all("td")[1].text)
+ reason = tidyup.reason(reason) if reason != "" else None
logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason)
if blocked in [None, ""]:
headers = tuple()
try:
- logger.debug("Checking CSRF for domain='%s'", domain)
+ logger.debug("Checking CSRF for domain='%s' ...", domain)
headers = csrf.determine(domain, dict())
except network.exceptions as exception:
logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s)", type(exception), __name__)
continue
logger.debug("row[domain]='%s' - BEFORE!", row["domain"])
- peer = tidyup.domain(row["domain"])
+ peer = tidyup.domain(row["domain"]) if row["domain"] != "" else None
logger.debug("peer='%s' - AFTER!", peer)
if peer in [None, ""]:
reason = tidyup.reason(block["comment"]) if "comment" in block and block["comment"] is not None and block["comment"] != "" else None
- logger.debug("Appending blocker='%s',blocked='%s',reason='%s',block_level='%s'", domain, block["domain"], reason, block["severity"])
+ logger.debug("Appending blocker='%s',blocked='%s',reason='%s',block_level='%s' ...", domain, block["domain"], reason, block["severity"])
blocklist.append({
"blocker" : domain,
"blocked" : block["domain"],
for instance in rows:
# Is it there?
logger.debug("instance[]='%s'", type(instance))
- blocked = tidyup.domain(instance["host"])
- logger.debug("blocked='%s'", blocked)
+ blocked = tidyup.domain(instance["host"]) if instance["host"] != "" else None
+ logger.debug("blocked='%s' - AFTER!", blocked)
if blocked in [None, ""]:
logger.warning("instance[host]='%s' is None or empty after tidyup.domain() - SKIPPED!", instance["host"])
start = 0
try:
- logger.debug("Checking CSRF for domain='%s'", domain)
+ logger.debug("Checking CSRF for domain='%s' ...", domain)
headers = csrf.determine(domain, dict())
except network.exceptions as exception:
logger.warning("Exception '%s' during checking CSRF (fetch_peers,%s)", type(exception), __name__)