Python Script to Bulk Audit Broken Internal Links and 301 Redirect Chains from an XML Sitemap
You crawl a sitemap, follow every internal link, and write a CSV of anything that returns a 404, a 5xx, or a redirect chain longer than one hop. The script below does exactly that with requests and lxml, no crawler framework required. It reads your sitemap.xml, extracts every <loc>, fetches each URL with redirects disabled…