TruthLens – Project Story
💡 Inspiration
It started with a simple realization during a late-night study session.
I was researching a topic for class and had 6 tabs open — all covering the same event. Every article told a different story. Same facts, completely different emotional tone. One made me angry. One made me scared. One felt completely neutral.
That's when it hit me: the problem isn't fake news. The problem is that we can't feel when we're being manipulated.
Misinformation doesn't always look like a lie. It looks like a carefully written article that uses fear words, removes counter-perspectives, and frames everything to make you feel a certain way — without you ever noticing.
Existing tools only fact-check specific claims. Nobody was detecting manipulation intent — the how and why behind the writing, not just the what.
That gap inspired TruthLens.
🔨 How I Built It
TruthLens is a Chrome Extension (Manifest V3) built entirely in vanilla JavaScript — no frameworks, no backend servers.
Architecture
The extension has 4 main components:
1. Content Script (content.js) — The Analysis Engine
This runs locally on every webpage. It:
- Extracts the main article text using semantic selectors
- Runs 6 pattern detectors against a curated word database
- Calculates a weighted Manipulation Score (0–100)
- Detects bias direction using keyword frequency analysis
- Identifies AI-assisted writing patterns using regex signatures
- Flags academic credibility issues for Student Mode
2. Pattern Database I built a custom NLP pattern database covering 6 manipulation categories:
| Category | Examples |
|---|---|
| Fear Induction | catastrophic, disaster, deadly, imminent |
| Anger Trigger | outrage, corrupt, scandal, fraud |
| False Urgency | act now, last chance, breaking, exclusive |
| Loaded Language | regime, radical, deep state, propaganda |
| Absolute Language | always, never, proven, undeniable |
| Emotional Bait | you won't believe, they don't want you to know |
3. Bias Spectrum Engine Instead of a binary "biased / not biased" rating, TruthLens maps content across 4 dimensions simultaneously:
- Left-Leaning indicators
- Right-Leaning indicators
- Pro-Corporate language
- Academic/Neutral language
This produces a bias confidence score with a direction — far more informative than existing tools.
4. AI Deep Analysis (Gemini API) When local analysis isn't enough, users can trigger a Gemini AI analysis. Crucially — no page content is sent. Only the scan summary (scores, counts, pattern names) is transmitted. This was a deliberate privacy-first design decision.
📚 What I Learned
Manipulation is subtle by design. Building the pattern database forced me to deeply study real propaganda techniques — Bandwagon, Fear Appeal, Loaded Language, and False Dichotomy. I came out of this project reading articles very differently.
Local-first is underrated. Most AI tools send your browsing data to servers. Keeping all analysis in the browser made TruthLens faster, private, and more trustworthy — and it taught me how much can be done client-side.
Chrome Extension APIs are powerful and complex. Working with Manifest V3, service workers, content script isolation, and cross-context messaging was challenging but rewarding.
Pattern matching ≠ understanding. Regex and keyword databases can detect signals, but they're not perfect. This taught me the limits of rule-based systems versus true NLP — and why the AI layer exists as a complement, not a replacement.
🚧 Challenges I Faced
1. False Positives in Pattern Detection Early versions flagged academic papers as "highly manipulative" because they used absolute language like "the study conclusively proves." I had to build weighted scoring and context-awareness to reduce noise.
2. Content Extraction Different websites structure their HTML completely differently. Building a robust text extractor that works on news sites, blogs, Medium, Wikipedia, and research portals required extensive testing and fallback logic.
3. Privacy vs. Functionality I wanted AI-powered analysis but didn't want to send users' browsing history to an API. The solution — sending only the numerical scan summary, never the page text — required rethinking the entire AI integration architecture.
4. Bias Detection Without Political Bias Detecting political bias without introducing political bias into the detector itself was genuinely hard. I tried to balance the word databases equally across the political spectrum and focus on language patterns rather than topic detection.
🌍 Impact
Every day, 3.2 billion people consume online content designed to influence how they think and feel. Students, researchers, journalists, and everyday readers lack the tools to detect this in real time.
TruthLens doesn't tell you what to believe. It shows you how you're being asked to believe it — and gives you the power to decide for yourself.
"The best defense against manipulation is awareness."
Built With
- chrome-extension-manifest-v3
- chrome-extensions-api
- css3
- custom-nlp-engine
- gemini-2.0-flash
- google-fonts
- google-gemini-api
- html5
- javascript
Log in or sign up for Devpost to join the conversation.