Skip to content

Repository files navigation

Privacy Policy Analyzer

Read the fine print, so you don't have to.

A CLI tool that fetches any privacy policy or terms of service from a URL, analyzes it for red flags, hidden meanings, unfair clauses, and missing protections, then gives you a risk score so you know exactly what you're agreeing to.

Features

  • Red Flag Detection — Flags data selling, forced arbitration, biometric collection, broad data sharing, and more
  • Hidden Meaning Finder — Detects vague language that masks unfavorable terms ("may", "legitimate business interests", "from time to time")
  • Negation Awareness — Correctly identifies when a suspicious phrase is negated (e.g., "We don't sell your data" is good news, not a red flag)
  • Risk Score (0-100) — Color-coded rating with severity breakdown
  • Missing Protections — Flags absent sections like data retention, user rights, contact info, or children's privacy
  • Consent Model Analysis — Detects opt-out vs opt-in patterns
  • Silent Collection Detection — Catches automatic/background data harvesting
  • Policy Date Extraction — Flags outdated or undated policies
  • File Export — Save reports to plain text
  • Optional AI Enhancement — Deep analysis via OpenRouter, OpenAI, or any compatible API
  • No AI Required — Core engine is pure Python with no heavy dependencies

Quick Start

Prerequisites

  • Python 3.8+

Install

git clone https://github.com/Disco-ronin/privacy-policy-analyzer.git
cd privacy-policy-analyzer
pip install -r requirements.txt

Usage

# Basic analysis
python3 analyzer.py https://example.com/privacy-policy

# Verbose output (shows section breakdown)
python3 analyzer.py https://example.com/privacy-policy -v

# Save report to file
python3 analyzer.py https://example.com/privacy-policy --output report.txt

# AI-enhanced analysis (optional)
python3 analyzer.py https://example.com/privacy-policy --ai --api-key YOUR_OPENROUTER_KEY

Example Output

============================================================
       PRIVACY POLICY ANALYZER
       Read the fine print, so you don't have to
============================================================

  RISK SCORE
  [=======================-----------------] 59/100 - MODERATE RISK

  RED FLAGS
  1. [HIGH] Data is shared with affiliated companies.
  2. [HIGH] The company may disclose your data under broad circumstances.
  3. [MEDIUM] Opt-out model: you must actively leave.

  GOOD NEWS
  + "sell your information" is mentioned but negated - they promise not to do this.

  MISSING PROTECTIONS
  ! No mention of protecting children's data.

What It Detects

Severity Examples
CRITICAL Selling your data, waiving right to sue, biometric/health data collection, SSN collection
HIGH Broad data sharing with affiliates, international data transfers, broad disclosure clauses
MEDIUM Opt-out consent model, aggregated data profiles, device fingerprinting
Vague Language "may", "such as", "from time to time", "legitimate business interests", "as necessary"
Missing No data retention policy, no contact info, no user rights, no children's privacy
Silent Collection Automatic/background data collection without consent

How It Works

  1. Fetch — Downloads the privacy policy page and extracts clean text from HTML
  2. Parse — Splits the document into sections and maps them to categories (Data Collection, Data Sharing, User Rights, etc.)
  3. Analyze — Runs 70+ pattern-matching rules with negation detection, vague language analysis, and missing section checks
  4. Score — Calculates a weighted risk score (0-100) based on severity and frequency of findings
  5. Report — Outputs a color-coded report with actionable findings

AI Enhancement (Optional)

For deeper analysis, connect an LLM via any OpenAI-compatible API:

# OpenRouter (free models available)
python3 analyzer.py https://example.com/privacy --ai --api-key YOUR_KEY

# OpenAI
python3 analyzer.py https://example.com/privacy --ai --api-key YOUR_KEY --api-base https://api.openai.com/v1 --model gpt-4o

# Use environment variable
export OPENROUTER_API_KEY=your_key
python3 analyzer.py https://example.com/privacy --ai

Project Structure

privacy_analyzer/
├── analyzer.py       # CLI entry point
├── fetcher.py        # URL fetching + HTML-to-text extraction
├── parser.py         # Section splitting + category mapping
├── rules.py          # 70+ red flag patterns, vague language, categories
├── engine.py         # Analysis engine with negation detection + scoring
├── reporter.py       # Color-coded CLI output + file export
├── ai_optional.py    # Optional LLM enhancement via OpenAI-compatible APIs
└── requirements.txt  # Dependencies

Requirements

requests
beautifulsoup4
lxml
colorama

Disclaimer

This tool provides automated analysis for informational purposes only. It is not legal advice. Always consult a qualified professional for important privacy or legal decisions.

License

This project is licensed under the GNU Affero General Public License v3.0.


Built with care for user privacy.

About

A command-line tool that fetches any privacy policy from a URL, analyzes it for red flags, hidden meanings, unfair clauses, and missing protections, then gives you a risk score, so you know exactly what you're agreeing to. It reads the fine print so you don't have to.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages