I created a Python Script to find out Broken links by scanning entire WordPress Website
I created a Python script to check links in all the WordPress posts to find out broken ones. I tried creating this after learning multi-threading based, I had this idea for so long because other broken link checking software such as SiteBulb and ScreamingFrog take very long time (\`24 hours) to crawl a one of my websites (having around 28000 posts). So, instead of crawling, I used WordPress API and this way it is much faster.

I will modify it later to do the same thing for non-WordPress website, by analyzing the sitemap.

It goes through all the posts one by one from WordPress API, extract all the URLs from &lt;a&gt; tag and then checks their status by making a HEAD request.

404 and other status codes are recorded. If the HEAD request fails, then name of the exception class is recorded.

Finally, save the report in CSV file.

[wpbroken script in action](https://preview.redd.it/30t209zd0ap81.png?width=1366&amp;format=png&amp;auto=webp&amp;s=1ad89fc845ee0e77ee20197b0a887301b46f9748)

GitHub Gist:  [wpbroken.py](https://gist.github.com/ilovefreesw/fa763e1f84cd9f7101dc4816e293beda)