Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/drkenreid/deadlinkscraper

A short Python script built in Google colab for iteratively searching subdomains for dead links.
https://github.com/drkenreid/deadlinkscraper

beautifulsoup scraper scraping scraping-websites

Last synced: 20 days ago
JSON representation

A short Python script built in Google colab for iteratively searching subdomains for dead links.

Awesome Lists containing this project

README

        

# ๐Ÿ•ท๏ธ Website Deadlink Scraper

## ๐Ÿ” Overview
This Python script is designed to scan websites for dead links (broken URLs) and save the results. It's particularly useful for website maintainers, SEO specialists, and developers who want to ensure their websites are free of broken links.

## โœจ Features
- **๐Ÿงต Multithreaded Scanning**: Utilizes Python's `ThreadPoolExecutor` for efficient, parallel processing of web pages.
- **โ˜๏ธ Google Drive Integration**: Automatically saves results and scan history to Google Drive, making it easy to run in Google Colab.
- **๐Ÿ•ณ๏ธ Depth Control**: Configurable maximum depth for scanning, preventing endless crawling of large websites.
- **๐Ÿ“œ Scan History**: Keeps track of previously scanned pages to avoid unnecessary rescanning within a specified time frame.
- **๐ŸŒ Subdomain Handling**: Correctly processes and includes subdomains of the main website.
- **๐Ÿ“ Detailed Logging**: Provides comprehensive logs for debugging and monitoring the scanning process.
- **๐Ÿ“Š Progress Updates**: Real-time console updates on scanning progress.

## ๐Ÿ› ๏ธ Requirements
- Python 3.6+
- Required libraries:
- requests
- beautifulsoup4
- pandas
- google-colab (for Google Drive integration)

## ๐Ÿš€ Installation
1. Clone this repository:
```
git clone https://github.com/DrKenReid/website-deadlink-scraper.git
```
2. Install required packages:
```
pip install -r requirements.txt
```

## ๐Ÿ‘จโ€๐Ÿ’ป Usage
1. Open the script in Google Colab or your preferred Python environment.
2. Run the script:
```python
python website_deadlink_scraper.py
```
3. When prompted, enter the base URL of the website you want to scan (e.g., 'example.com').
4. The script will start scanning and display progress in real-time.
5. Results will be saved in your Google Drive under the folder 'WebScraperResults/[website_name]'.

## โš™๏ธ Configuration
You can modify the following parameters in the `WebsiteDeadlinkScraper` class:
- `max_pages`: Maximum number of pages to scan (default: 10000)
- `max_depth`: Maximum depth of links to follow from the base URL (default: 20)

## ๐Ÿ“ค Output
The script generates two CSV files in the Google Drive folder:
1. `deadlinks.csv`: Contains all identified dead links with their source pages.
2. `scan_history.csv`: Keeps track of scanned URLs and their last scan date.

## โš ๏ธ Limitations
- The script is designed to run in Google Colab for easy Google Drive integration. Modifications may be needed for local use.
- It doesn't consider the 'robots.txt' file. Ensure you have permission to scan the target website.
- Large websites may take a considerable amount of time to scan completely.

## ๐Ÿค Contributing
Contributions, issues, and feature requests are welcome. Feel free to check [issues page](https://github.com/DrKenReid/DeadLinkScraper/issues) if you want to contribute.

## ๐Ÿ“„ License
This project is licensed under the MIT License.

## โš–๏ธ Disclaimer
This tool is for educational and maintenance purposes only. Always ensure you have permission to scan a website and use this tool responsibly.