Skip to content

Repository files navigation

Focus 2.0 — YouTube Content Filter

A Chrome extension that uses a self-hosted ML API to classify YouTube videos as constructive or non-constructive in real-time. Non-constructive content is blocked automatically.

What it does

  • Blocks: Gaming, Entertainment, Vlogs, Pranks, Clickbait, Shorts
  • Allows: Education, Music, News, Science & Technology
  • Feed Pre-Scanner: Scans all thumbnails on the homepage and dims non-constructive videos before you even click
  • Smart Caching: Learns channel decisions for instant future lookups

How it works

YouTube Page → Content Script scrapes metadata → Background sends to ML API → Block/Allow

The extension sends video title, channel, and description to our own Flask API server (/predict) which runs a Logistic Regression model trained on 9,000+ real YouTube videos. No third-party API keys needed.

Installation

  1. Clone this repo
  2. Go to chrome://extensions/
  3. Enable Developer mode
  4. Click Load unpacked and select this folder
  5. The ML server URL is pre-configured — no setup needed

Tech Stack

  • Extension: Chrome Manifest V3 (content script + service worker)
  • ML Server: Flask + scikit-learn (self-hosted on Oracle VM)
  • Model: TF-IDF + Logistic Regression — 99.4% accuracy
  • Batch API: /predict/batch classifies up to 50 videos in one request

API

The extension talks to a self-hosted Flask API at http://161.118.170.116:8080.

Endpoint Method Description
/health GET Check if server & model are running
/predict POST Classify a single video
/predict/batch POST Classify up to 50 videos at once

Check if API is working

curl http://161.118.170.116:8080/health

Expected response:

{ "status": "ok", "model_loaded": true }

Classify a video

curl -X POST http://161.118.170.116:8080/predict \
  -H "Content-Type: application/json" \
  -d '{"channel": "3Blue1Brown", "title": "Linear Algebra Explained", "description": "A visual guide"}'

Response:

{ "constructive": true, "confidence": 0.9999, "message": "yes" }

About

YouTube Content Filter Chrome Extension - Blocks non-constructive content and Shorts, allows only Education, Music, News & Science. Here its integrated with our own ml(with api)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages