Skip to content

Instantly share code, notes, and snippets.

@hackerdem
Last active March 27, 2026 08:39
Show Gist options
  • Select an option

  • Save hackerdem/2872d7f994d192188970408980267e6e to your computer and use it in GitHub Desktop.

Select an option

Save hackerdem/2872d7f994d192188970408980267e6e to your computer and use it in GitHub Desktop.
A simple python script to check broken links of a wesite
@allandequeiroz

Copy link
Copy Markdown

Thanks for sharing!

@ssousaleo

Copy link
Copy Markdown

thanks a lot. It's very useful

@Hasokeyk

Hasokeyk commented Dec 21, 2017

Copy link
Copy Markdown

Thanks Bro 👍

@DanielKoohmarey

Copy link
Copy Markdown

Check out my fork if anyone needs a python 2.7 link checking library

@wgrv

wgrv commented Jan 25, 2018

Copy link
Copy Markdown

Hi Thanks a Lot or the Script... I tried to run on my Site and gave a single Hyper Link and its running for All the Links and giving me the output ...There are Many Links and is there any way that we know the base-link where the Link that is found to be Broken ...?

@DanielKoohmarey

Copy link
Copy Markdown

@hackerdem whats the license for this file?

@RafaelAMello

Copy link
Copy Markdown

Nice!

@Ailothaen

Copy link
Copy Markdown

Hey, wonderful script. However, it seems that it keeps running on the other domains linked, which is kinda an unwanted behavior (for example, if I include a link to Google on my website, it will scan Google as well...). Could a fix be made in order to only restrict the crawl to the same domain?

@Pavan2303

Copy link
Copy Markdown

For this code now how to print those links in a document or excel sheet?

@hackerdem

Copy link
Copy Markdown
Author

Hey, please try to implement some additional code to check every link's root url to a base url, so if it is not the same, it won't run on it. Another question is about printing results to another file, I think for this purpose, python's csv library can be used.

@saiteja13427

Copy link
Copy Markdown

Hey, try to include a header as well with the urlopen request. Some website gives 403 forbidden if the request is unknown. It should look something like
url = "https://atomstalk.com" headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1)'} info = urllib.request.urlopen(urllib.request.Request(url=url, headers=headers))

@Rini-bosco

Copy link
Copy Markdown

how to debug if code is not working for a given url ??

@tiffanyveritas

Copy link
Copy Markdown

Thanks. It works right out of the box!

@Akanksha0704

Copy link
Copy Markdown

can someone explain each parts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment