Purelink is a bot designed to detect, unwrap, and clean tracking links, extracting destination URLs from affiliate redirect chains.
- 3,500+ Tracking Domains: Integrated blocklist for unwrapping and sanitizing ad, affiliate, and tracking domains.
- Mavely & Amazon Sanitization: Logic for cleaning Mavely redirects and stripping Amazon tracking parameters.
- Webhook Reposting: Deletes messages containing tracking links and reposts them using the original user's name and avatar with cleaned URLs.
- Dynamic Configuration: Decoupled
data.jsonfor managing tracking rules. - Security Hardened: IP-level SSRF protection, strict TLS verification, and 5-link processing cap per message.
- Multi-Hop Chain Resolution: Resolution logic for tracing deeply nested affiliate redirect chains.
- Known Unsupported Domains: List of domains that block automated resolution: unsupported.md
- Python 3.8+
- Discord Bot Token with Message Content Intent enabled.
- Clone the repository:
git clone https://github.com/psalm2517/purelink-bot.git cd purelink-bot - Install dependencies:
pip install -r requirements.txt
- Prepare configuration:
- Rename
.env.exampleto.env. - Add your Discord bot token to the
TOKEN=field in.env.
- Rename
- Setup Environment:
sudo apt update && sudo apt install -y python3-pip python3-venv python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
- Configure Service:
sudo cp purelink.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable purelink-bot sudo systemctl start purelink-bot - Monitor Logs:
sudo journalctl -u purelink-bot -f
Required bot permissions:
- Manage Messages: To delete original tracking link messages.
- Manage Webhooks: To repost cleaned messages.
- Send Messages: General function.
- Read Message History: To process incoming links.
python main.pyTo report an uncleaned link: Open a Domain Suggestion issue.
Purelink is licensed under LGPL-3.0.
- Forked from CleanURLs Discord Bot.
- Logic adapted from Unalix.