ratduckowlgymnastics
kiwifarms.net
- Joined
- Mar 18, 2026
Head talking about being on America's Funniest Home Videos and RETURN OF THE KING BASHIR
Script below that will import the streams into OBS Sources (save as fishtank_obs.py)
Script below that will import the streams into OBS Sources (save as fishtank_obs.py)
Python:
#!/usr/bin/env python3
# NEEDS THIS COMMAND RUN FIRST TO INSTALLS DEPS
# pip install requests obs-websocket-py click
# OBS > 28+
# OBS settings: Tools-> Websocket Server Settings then Enable Websocket Server. I disabled authentication on mine, but you could set a password if desired then run with it.
# How to run (OBS must be running and it'll change your sources):
# ./fishtank_obs.py list
# ./fishtank_obs.py sync --clear
# Use this if using password:
# ./fishtank_obs.py sync --clear --password TYPE_PASSWORD_HERE
# Click on the eye lower left to view stream
import requests
import click
from obswebsocket import obsws, requests as obsreq
API_URL = "https://api.ppv.to/api/fishtank"
def fetch_streams():
data = requests.get(API_URL).json()
return data["data"]["liveStreams"]
def connect_obs(host, port, password):
ws = obsws(host, port, password)
ws.connect()
return ws
@click.group()
def cli():
pass
@cli.command()
@click.option("--scene", default="Fishtank", help="OBS scene name")
@click.option("--host", default="localhost")
@click.option("--port", default=4455)
@click.option("--password", default="")
@click.option("--clear", is_flag=True, help="Clear scene first")
def sync(scene, host, port, password, clear):
"""Sync fishtank streams into OBS"""
streams = fetch_streams()
ws = connect_obs(host, port, password)
# Create scene if not exists
scenes = ws.call(obsreq.GetSceneList()).getScenes()
if scene not in [s["sceneName"] for s in scenes]:
ws.call(obsreq.CreateScene(sceneName=scene))
click.echo(f"Created scene: {scene}")
# Clear scene if requested
if clear:
items = ws.call(obsreq.GetSceneItemList(sceneName=scene)).getSceneItems()
for item in items:
ws.call(obsreq.RemoveSceneItem(
sceneName=scene,
sceneItemId=item["sceneItemId"]
))
click.echo("Scene cleared")
# Add streams
for stream in streams:
name = stream.get("name")
url = stream.get("playbackUrl")
if not url:
continue
click.echo(f"Adding: {name}")
ws.call(obsreq.CreateInput(
sceneName=scene,
#sceneItemId=item["sceneItemId"],
sceneItemEnabled=False,
inputName=name,
inputKind="ffmpeg_source",
inputSettings={
"input": url,
"is_local_file": False,
"restart_on_activate": True,
"close_when_inactive": True
}
))
ws.disconnect()
click.echo("Done.")
@cli.command()
def list():
"""List available streams"""
streams = fetch_streams()
for s in streams:
click.echo(f"{s['name']} -> {s.get('playbackUrl')}")
if __name__ == "__main__":
cli()









