Skip to content

Instantly share code, notes, and snippets.

@domiko96
Created July 30, 2024 16:11
Show Gist options
  • Select an option

  • Save domiko96/85345d3197f766d643bc31daf60022fe to your computer and use it in GitHub Desktop.

Select an option

Save domiko96/85345d3197f766d643bc31daf60022fe to your computer and use it in GitHub Desktop.
OSS video download Python
# Copy this to your home folder and have requests installed (pip install requests)
import requests
resp = requests.get("http://192.168.2.100:80/api/video")
for video in resp.json():
file_name = video["dir"].replace("%2B", "+") + "_" + video["name"]
url = f"http://192.168.2.100:80/api/video/{video['dir']}/{video['name']}"
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open("Downloads/" + file_name, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Downloaded {file_name}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment