Turn any YouTube Live stream into an AI-powered data source. Monitor live video for conditions, get real-time alerts, and generate stream summaries.
pip install trio-pythonOr install from source:
pip install git+https://github.com/machinefi/trio-python.gitfromtrioimportTrioclient=Trio("your_api_key")
# One-shot checkresult=client.check(
"https://youtube.com/watch?v=jfKfPfyJRdk",
"Is there an animated character visible?"
)
print(result["triggered"]) # Trueprint(result["explanation"]) # "Yes, there is an animated girl..."Instant condition check on a live stream:
result=client.check(stream_url, "Is it raining?")
ifresult["triggered"]:
print(f"Rain detected: {result['explanation']}")Continuous monitoring with webhook alerts:
job=client.monitor(
stream_url="https://youtube.com/watch?v=LIVE_ID",
condition="Is there a person in frame?",
webhook_url="https://your-server.com/webhook",
interval_seconds=10
)
print(f"Monitoring: {job['job_id']}")Generate AI summaries of stream activity:
job=client.digest(
stream_url="https://youtube.com/watch?v=LIVE_ID",
webhook_url="https://your-server.com/summary",
window_minutes=5
)# List all jobsjobs=client.list_jobs()
# Check job statusstatus=client.get_job("job_id")
# Cancel a jobclient.cancel_job("job_id")| Method | Description |
|---|---|
check(stream_url, condition) | One-shot condition check |
monitor(stream_url, condition, webhook_url) | Start continuous monitoring |
digest(stream_url, webhook_url) | Start stream summarization |
list_jobs() | List all jobs |
get_job(job_id) | Get job status |
cancel_job(job_id) | Cancel a job |
Sign up at console.machinefi.com to get your API key.
Full documentation: docs.machinefi.com
Apache 2.0