From 72a8aa373ebe8bc5b82edc8aa0b58b09f54ffb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=8A?= Date: Wed, 23 Apr 2025 10:08:55 +0000 Subject: [PATCH] https://github.com/AJaySi/AI-Writer/issues/165 --- lib/ai_seo_tools/on_page_seo_analyzer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ai_seo_tools/on_page_seo_analyzer.py b/lib/ai_seo_tools/on_page_seo_analyzer.py index 9847d90f..412f6733 100644 --- a/lib/ai_seo_tools/on_page_seo_analyzer.py +++ b/lib/ai_seo_tools/on_page_seo_analyzer.py @@ -157,10 +157,12 @@ def analyze_links(soup): if not validators.url(href): continue try: - response = requests.head(href, timeout=5) + response = requests.head(href, timeout=5, allow_redirects=True) if response.status_code >= 400: broken_links.append(href) - except requests.RequestException: + except requests.RequestException as e: + # Log the exception for debugging purposes + print(f"Error checking link {href}: {e}") broken_links.append(href) return broken_links except Exception as e: