Skip to content

mathieu-neron/AIBlockerServerPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIBlockerServerPy

Python/Django implementation of the AIBlocker API server for crowdsourcing AI content classifications on YouTube videos.

Tech Stack

  • Framework: Django 5.x + Django REST Framework
  • Database: PostgreSQL
  • Async Tasks: Celery + Redis
  • Python: 3.12+

Prerequisites

  • Python 3.12+
  • PostgreSQL
  • Redis

Setup

1. Clone and create virtual environment

cd AIBlockerServerPy
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

2. Install dependencies

pip install -r requirements.txt

3. Configure environment

cp .env.example .env
# Edit .env with your configuration

Required environment variables:

  • SECRET_KEY - Django secret key
  • DATABASE_URL - PostgreSQL connection string
  • REDIS_URL - Redis connection string
  • SALT - Salt for hashing user IDs (IMPORTANT: change in production!)

4. Create PostgreSQL database

createdb aiblocker

5. Run migrations

python manage.py migrate

6. Start the server

Development:

python manage.py runserver 8080

Production:

gunicorn aiblocker.wsgi:application --bind 0.0.0.0:8080

7. Start Celery worker (separate terminal)

celery -A aiblocker worker --loglevel=info

API Endpoints

Method Endpoint Description
GET /api/health Health check
POST /api/reports Submit AI content report
POST /api/reports/{id}/vote Vote on a report
GET /api/videos/{hash}/status Get video AI status
GET /api/videos/{hash}/reports Get detailed reports
GET /api/videos/{hash}/reports/summary Get aggregated summary
POST /api/videos/batch Batch query videos

API Compatibility

This server maintains full API compatibility with the original TypeScript/Node.js implementation, allowing the AIBlocker Chrome extension to work without modifications.

Development

Run tests:

python manage.py test

Check for issues:

python manage.py check

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages