This Python tool helps website owners analyze and identify toxic backlinks and generate a properly formatted disavow file for Google Search Console. It uses SEMrush-exported backlink data as input to streamline the process of managing harmful links and improving SEO performance.
- Analyze SEMrush Backlink Data: Automatically filter toxic backlinks based on spam score, excessive external links, spammy anchor text, and sitewide links.
- Domain-Level Disavow File: Generate a Google-compliant disavow file by extracting domain-level URLs.
- Customizable Criteria: Easily modify toxicity thresholds to suit specific needs.
- Error Handling: Ensures malformed or incomplete data is handled gracefully.
- Clone the repository:
git clone https://github.com/uzairnz/disavow-tool.git cd disavow-tool
- Install dependencies:
pip install pandas
- Log in to your SEMrush account.
- Navigate to the Backlink Audit tool.
- Export your backlink list in CSV format.
- Save the file as
backlinks_data.csv
in the project directory.
- Execute the script:
python generate_disavow.py
- The script will analyze the backlinks and create a disavow file named
disavow_corrected.txt
in the project directory.
- Go to the Google Disavow Tool.
- Upload the generated
disavow_corrected.txt
file.
- You can customize the analysis thresholds in the
analyze_backlinks
function:- Spam Score: Default is
> 30
. - External Links: Default is
> 500
. - Anchor Text: Flags anchor text containing "spam".
- Sitewide Links: Flags sitewide backlinks marked as
TRUE
.
- Spam Score: Default is
Ensure the SEMrush-exported CSV file has the following structure:
Page ascore | Source title | Source url | Target url | Anchor | External links | Internal links | Sitewide | ... |
---|---|---|---|---|---|---|---|---|
50 | Example Title | http://example.com/spam-link | https://yourwebsite.com/page1 | spam anchor | 1000 | 500 | TRUE | ... |
25 | Legit Title | https://legitwebsite.com/good-link | https://yourwebsite.com/page2 | good anchor | 50 | 20 | FALSE | ... |
The generated disavow file will contain entries like:
# Disavow file generated for toxic backlinks
domain:example.com
domain:another-spam-site.com
We welcome contributions! Here’s how you can help:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add new feature"
- Push the branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.