YouTube Judol (Judi Online) Spam Detector

September 20, 2026 · View on GitHub

A Tampermonkey userscript that flags Indonesian online-gambling ("judol") spam comments on YouTube. Classification is done entirely by zero-shot text classification via classifier.dev (the jev decision model) — no fine-tuning, no hosted model, no API key.

Comments are classified as they scroll into view and batched into a single HTTP request.


Installation

Install from URL — with Tampermonkey installed, open:

https://raw.githubusercontent.com/arashari/youtube-judol-userscript-jev/main/youtube-judol-detector.user.js

Or manually:

  1. Install Tampermonkey (Chrome/Firefox/Edge) or Violentmonkey (Firefox).
  2. Open the dashboard and create a new script.
  3. Paste the full contents of youtube-judol-detector.user.js.
  4. Save (Ctrl+S / Cmd+S).
  5. Open any YouTube video and scroll to the comments.

How it works

  1. Scroll detection — an IntersectionObserver queues comments as they approach the viewport (200px margin).
  2. Batching — queued comments are collected for debounceMs (400ms), then up to batchSize (50) are sent in one POST https://classifier.dev/v1/classify.
  3. Three labels — Jev picks one per comment:
    • promosi judi onlinejudol (red, optionally hidden)
    • spam promosi non-judiother spam (orange)
    • komentar biasa → clean
  4. Confidence — answers below confidenceThreshold (0.6), or answers with no comparable score, are marked unsure (yellow) instead of spam.
  5. Feedback — highlighting, badges, a "Hide All Judol" button, and a live stats panel.

The instructions field steers the model so that discussing, reporting on, or condemning gambling is not treated as promotion. This is what keeps comments like judi online itu haram clean.

Requests go through GM_xmlhttpRequest (with a fetch fallback) so YouTube's Content Security Policy can't silently block them.


Configuration

Edit CONFIG at the top of the script:

const CONFIG = {
    apiUrl: 'https://classifier.dev/v1/classify',
    tier: 'fast',            // 'fast' (~250ms) or 'smart' (re-asks low-confidence answers, slower)

    labels: {
        judol: 'promosi judi online',
        otherSpam: 'spam promosi non-judi',
        clean: 'komentar biasa',
    },
    instructions: "...",     // criteria that separate promotion from discussion

    confidenceThreshold: 0.6,
    sessionCap: 5000,        // stop sending after N classifications on one page

    batchSize: 50,
    debounceMs: 400,
    maxRetries: 3,

    hideSpam: false,
    highlightSpam: true,
    highlightUnsure: true,
    showBadge: true,
    showStats: true,
    logDebug: false,
    debugScores: false,      // badge EVERY comment (incl. clean) with the raw score map
};

Relabel labels and adjust instructions to change what counts as spam. Descriptive label names classify better than terse ones.

Tuning the threshold: set debugScores: true to badge every comment — including clean ones — with the raw score map, e.g. judol 0.99 · spam 0.01 · clean 0.00, colour-coded by verdict. It overrides showBadge and is the easiest way to see borderline cases before changing confidenceThreshold.


Limits and cost

classifier.dev's free tier is per IP: 3,000 classifications/minute and 20,000/day on the fast tier (200 / 2,000 on smart). One classification is one comment. The script handles 429 responses with Retry-After, retries 5xx with backoff, and stops at sessionCap.

The smart tier re-asks every single-label answer below 0.7 confidence of a reasoning model — better accuracy on ambiguous comments, but seconds per escalated item. For scrolling comment sections, fast is the right default.


Privacy

Comment text is sent to classifier.dev. Their documentation states the text is not stored or logged and goes only to the model provider for the classification. If that is not acceptable, run a dedicated deployment (see their docs) and point apiUrl at it.


Troubleshooting

  • Nothing is flagged — set logDebug: true and check the console for [JudolDetector] lines. A 400 means the labels/instructions are malformed; a 429 means you hit the rate limit.
  • Comments are flagged as unsure — Jev was not confident enough, or the API returned no score. Lower confidenceThreshold to flag more aggressively.
  • Errors counter rises — the batch request failed after retries; those comments are re-queued and retried, then dropped.

License

MIT