Official Python SDK for VideoCensor content moderation API — profanity detection, hate speech, censoring for text, audio and video.
Project description
videocensor
Python SDK for VideoCensor content moderation API.
Installation
pip install videocensor
Quick Start
from videocensor import VideoCensor
with VideoCensor(api_key="vc_live_...") as client:
# Analyze text
result = client.analyze_text("some text to check")
print(result.flagged_count, result.categories)
# Censor text
censored = client.censor_text("some text to censor")
print(censored.censored)
# Analyze media file
job = client.analyze_media("/path/to/video.mp4")
completed = client.wait_for_job(job.id)
analysis = client.get_job_result(completed.id)
# Censor media from URL
censor_job = client.censor_media_url("https://youtube.com/watch?v=...")
done = client.wait_for_job(censor_job.id)
client.download_job(done.id, "./censored.mp4")
Async Client
from videocensor import AsyncVideoCensor
async with AsyncVideoCensor(api_key="vc_live_...") as client:
result = await client.analyze_text("some text")
job = await client.analyze_media("/path/to/file.mp4")
completed = await client.wait_for_job(job.id)
Configuration
client = VideoCensor(
api_key="vc_live_...", # Required. Use vc_test_ for sandbox.
base_url="https://videocensor.ru/api/v1", # Optional
timeout=30.0, # Optional (seconds)
max_retries=3, # Optional
)
API
Text
| Method | Description |
|---|---|
analyze_text(text, *, language, categories, preset) |
Analyze text |
censor_text(text, *, language, replacement, categories, preset) |
Censor text |
Media
| Method | Description |
|---|---|
analyze_media(file, *, language, mode, categories, preset) |
Upload and analyze |
censor_media(file, *, language, mode, way_of_blocking, ...) |
Upload and censor |
analyze_media_url(url, *, ...) |
Analyze from URL |
censor_media_url(url, *, ...) |
Censor from URL |
Jobs
| Method | Description |
|---|---|
list_jobs(*, page, limit, status) |
List jobs |
get_job(job_id) |
Get job status |
get_job_result(job_id) |
Get full result |
cancel_job(job_id) |
Cancel job |
download_job(job_id, output_path) |
Download file |
get_transcript(job_id, fmt) |
Get transcription |
wait_for_job(job_id, *, timeout, poll_interval) |
Poll until done |
Batch, Webhooks, Account
| Method | Description |
|---|---|
create_batch(requests) |
Submit batch |
get_batch(batch_id) |
Get batch result |
list_webhooks() |
List endpoints |
create_webhook(url, events) |
Create endpoint |
delete_webhook(webhook_id) |
Delete endpoint |
get_account() |
Account info |
Error Handling
from videocensor import VideoCensorError, RateLimitError, AuthenticationError
try:
result = client.analyze_text("test")
except RateLimitError as e:
print(f"Retry after {e.retry_after}s")
except AuthenticationError:
print("Invalid API key")
Content Categories
profanity, hate_speech, extremism, drugs, sexual, insults
Requirements
Python >= 3.10, httpx >= 0.25
Versioning
This SDK follows SemVer:
- MAJOR — breaking changes (removed endpoints/fields, type changes). Deprecation notice at least 3 months in advance.
- MINOR — new endpoints or optional fields.
- PATCH — bugfixes, retry/backoff improvements, docs.
See CHANGELOG.md for release notes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file videocensor-1.0.0.tar.gz.
File metadata
- Download URL: videocensor-1.0.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d47435abedbd3f5e50736722179668ded0fe630cd8fd74efe07f03b0f0dbe588
|
|
| MD5 |
21d70ff8c8da45a4717e35a43c218257
|
|
| BLAKE2b-256 |
efb05005d7d4b3faa0acf5eecca74cd9fa59d033bc53e0d8c17f8b5f245b11e7
|
File details
Details for the file videocensor-1.0.0-py3-none-any.whl.
File metadata
- Download URL: videocensor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff8f7fff4488c4b3ebc31f12d67a32f98d65ba6c0da09f3fa87e01f89e62411f
|
|
| MD5 |
b4792961b15b236c8298566c34c575a9
|
|
| BLAKE2b-256 |
838b0cc8b1f6944e3bcab0f9786d4dd19c0adaa3800e0ff55e310682ed64b9ab
|