Skip to content

Instantly share code, notes, and snippets.

@hackerdem
Last active January 5, 2023 18:22
Show Gist options
  • Save hackerdem/2872d7f994d192188970408980267e6e to your computer and use it in GitHub Desktop.
Save hackerdem/2872d7f994d192188970408980267e6e to your computer and use it in GitHub Desktop.
A simple python script to check broken links of a wesite
@hackerdem
Copy link
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

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

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

@tiffanyveritas
Copy link

Thanks. It works right out of the box!

@Akanksha0704
Copy link

can someone explain each parts?

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