Here’s a Python script to identify outdated or broken links from a list of URLs. It checks each link’s HTTP response and flags those that return a status code of 400 or higher (which typically indicates errors like “Not Found” or “Forbidden”).
How to Use:
-
Replace
urls_to_check
with your list of URLs. -
Run the script using Python 3.
-
The output will show each URL, its status code, and whether it’s OK or Broken.
Notes:
-
Uses
requests.head()
for faster checking without downloading full content. Userequests.get()
if servers don’t support HEAD requests reliably. -
ThreadPoolExecutor
speeds up the process with parallel requests. -
You can adapt it to read from a file or export broken URLs to a report.
Let me know if you want a version that crawls a site and checks links automatically.
Leave a Reply