⚡Adult Content Filter API

API Endpoint

POST ...

SDK (JS)

const AdultFilter = { API: "...", check: async function(file) { if (!file) throw new Error("No file"); if (file.type.startsWith('image/')) return this._s(file); if (file.type.startsWith('video/')) return this._v(file); throw new Error("Invalid type"); }, // Image Scan _s: async function(b) { try { const r = await fetch(this.API, { method: "POST", body: b }); if (!r.ok) throw new Error("API Error"); return await r.json(); } catch (e) { return { status: "Error" }; } }, // Video Scan (Optimized 3 Frames) _v: async function(f) { const url = URL.createObjectURL(f); const v = document.createElement('video'); v.src = url; v.muted = true; v.playsInline = true; await new Promise(r => v.onloadedmetadata = r); let finalStatus = "Safe"; const points = [0.1, 0.5, 0.9]; for (let p of points) { v.currentTime = v.duration * p; await new Promise(r => v.onseeked = r); const c = document.createElement('canvas'); c.width = v.videoWidth; c.height = v.videoHeight; c.getContext('2d').drawImage(v, 0, 0); // Low quality jpg (0.7) for speed const b = await new Promise(r => c.toBlob(r, 'image/jpeg', 0.7)); const res = await this._s(b); if (res.status === "Adult") { finalStatus = "Adult"; break; } } URL.revokeObjectURL(url); v.remove(); return { status: finalStatus }; } };

🧪 Live Tester

☁️
Drag & Drop or Tap
Images & MP4