Skip to content

Psalm2517/purelink-bot

Repository files navigation

Purelink Discord Bot

Purelink is a bot designed to detect, unwrap, and clean tracking links, extracting destination URLs from affiliate redirect chains.

License: AGPL v3 Python


Key Features

  • 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.json for 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

Setup

1. Requirements

  • Python 3.8+
  • Discord Bot Token with Message Content Intent enabled.

2. Installation

  1. Clone the repository:
    git clone https://github.com/psalm2517/purelink-bot.git
    cd purelink-bot
  2. Install dependencies:
    pip install -r requirements.txt
  3. Prepare configuration:
    • Rename .env.example to .env.
    • Add your Discord bot token to the TOKEN= field in .env.

3. Oracle Cloud Deployment (Ubuntu)

  1. 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
  2. Configure Service:
    sudo cp purelink.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable purelink-bot
    sudo systemctl start purelink-bot
  3. Monitor Logs:
    sudo journalctl -u purelink-bot -f

4. Permissions

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.

5. Execution

python main.py

🤝 Contributing

To report an uncleaned link: Open a Domain Suggestion issue.


License & Attribution

Purelink is licensed under LGPL-3.0.

About

Purelink Bot is a high-performance fork of the ClearURLs Discord Bot, specifically tailored to detect, clean, and unwrap tracking links.

Topics

Resources

License

Stars

Watchers

Forks

Contributors