DEV Community

Cover image for How I built a free deepfake detector that works directly from social media URLs
Prolific Virtual Assistant
Prolific Virtual Assistant

Posted on

How I built a free deepfake detector that works directly from social media URLs

I built KweliAI — a free tool that checks whether
images and videos on social media are real, AI-generated, or deepfakes.
The thing that makes it different from every other detector I found:
you paste the post URL and it works. No downloading. No file upload.
Just paste and get a verdict.

This is how I built it.

The problem I was solving

Every deepfake detection tool I found required you to download the file
first. That sounds simple until you try to download a TikTok video or
an X post video — platforms deliberately make this difficult.

People who suspect they're being catfished, or who want to verify a
viral video before sharing it, don't want to fight with download tools.
They want to paste a link and get an answer.

Media extraction with yt-dlp

The core of KweliAI is yt-dlp — the most comprehensive media extraction
library available. It supports X, Reddit, TikTok, YouTube, Instagram,
and Facebook out of the box.

import yt_dlp

def download_media(url: str, output_path: str):
    ydl_opts = {
        'outtmpl': output_path,
        'format': 'best[ext=mp4]/best',
        'quiet': True,
        'no_warnings': True,
    }
    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        ydl.download([url])
Enter fullscreen mode Exit fullscreen mode

The tricky parts:

  • Each platform has different rate limits and URL structures
  • Videos need ffmpeg to merge audio and video streams
  • Private posts return authentication errors that need clear user messaging
  • yt-dlp updates weekly to keep up with platform changes — pin loosely

Three detection models running in parallel

Once the media is extracted, three models run simultaneously:

1. AI image detection — trained to identify images from Midjourney,
DALL·E, Stable Diffusion, and Adobe Firefly. Looks for GAN fingerprints
and diffusion model artifacts in pixel frequency patterns.

2. Deepfake detection — analyses facial boundary consistency,
blinking patterns, skin texture coherence, and temporal frame consistency
across video frames.

3. AI audio detection — checks whether voices in video content are
cloned or synthetic. Analyses spectral patterns and prosodic naturalness.

All three run in parallel using Python's concurrent.futures. The
results are combined into a single clarity score and a plain-English
verdict.

The stack

  • Backend: FastAPI on a DigitalOcean droplet behind Nginx
  • Detection: Hive Moderation API for the three model calls
  • Media extraction: yt-dlp + ffmpeg inside Docker
  • Auth + database: Supabase
  • Payments: Paystack (we're based in Kenya — Stripe wasn't an option)
  • Frontend: Plain HTML/CSS/JS on Vercel
  • Emails: Resend for transactional sequences

The Dockerfile

FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg curl && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --timeout=300 -r requirements.txt
COPY . .

RUN useradd -m appuser && chown -R appuser /app
USER appuser
RUN mkdir -p /tmp/kweliai

EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]
Enter fullscreen mode Exit fullscreen mode

The key thing here is ffmpeg — yt-dlp needs it to merge video and audio
streams for most platforms.

What surprised me

The use case I didn't expect. I built this for journalists and
fact-checkers. The actual users are people who met someone online and
want to verify their photos before getting emotionally invested.
Romance scam victims and people who've been catfished before. That
realization changed how I write about the tool.

yt-dlp breaks constantly. Platforms change their APIs and
authentication flows regularly. TikTok and Instagram are the worst.
I use >= version pinning for yt-dlp instead of == so it always
installs the latest version on build.

GEO matters more than SEO for tools like this. Getting indexed
by Bing feeds ChatGPT, Copilot, and Perplexity simultaneously.
ChatGPT started recommending KweliAI to users asking about deepfake
detection within three weeks of launch — before we had significant
Google rankings.

Lessons for anyone building detection tools

  1. Work from URLs not file uploads — removes the biggest friction point
  2. Run multiple models in parallel — single model accuracy is never enough
  3. Return plain English — "AI-generated with high confidence" not a score
  4. Handle platform errors gracefully — private posts, rate limits, and unsupported URLs all need clear user-facing messages
  5. Pin yt-dlp loosely — >=2026.1.1 not ==2026.3.17

KweliAI is free to use — 5 scans per day on X and Reddit with no
credit card required: kweliai.com

The awesome-deepfake-detection resource list I maintain is here:
github.com/MohammadNyundo/awesome-deepfake-detection

Happy to answer questions about the detection approach, the yt-dlp
extraction layer, or the Paystack integration.

Top comments (0)