Skip to content

Instantly share code, notes, and snippets.

@pmac
Created October 30, 2018 00:16
Show Gist options
  • Save pmac/cd78dccfc12e2ecbe6efc9eb216e47a3 to your computer and use it in GitHub Desktop.
Save pmac/cd78dccfc12e2ecbe6efc9eb216e47a3 to your computer and use it in GitHub Desktop.
Download all the videos between two events from Ring
# https://github.com/tchellomello/python-ring-doorbell
from ring_doorbell import Ring
# ID of the newest video you want
OLDER_THAN = 6589184120805222376
# ID of the oldest video you want
LAST_ONE = 6587337941997938664
# grab info on this many videos at a time
CHUNK_SIZE = 50
def download():
count = 0
eid = OLDER_THAN
while True:
events = deck.history(older_than=eid, limit=CHUNK_SIZE)
for event in events:
eid = event['id']
if eid < LAST_ONE:
return
deck.recording_download(eid, filename='videos/{}.mp4'.format(eid))
count += 1
print '%s %s' % (count, eid)
ring = Ring('<your account email>', '<your password>')
# play with the API to figure out which camera you want
deck = ring.stickup_cams[2]
download()
print '\nDONE.'
@Gamerios
Copy link

Hello a way to fix this? Often download 2-3 videos then this:

404 Client Error: Not Found for url: https://api.ring.com/clients_api/dings/6957702442342281921/recording?api_version=9
Traceback (most recent call last):
File "ring-videos-download.py", line 86, in
main()
File "ring-videos-download.py", line 71, in main
deck.recording_download(eid, filename='videos/{}.mp4'.format(eid))
File "/root/ringdownload/ring_doorbell/doorbot.py", line 342, in recording_download
req = self._ring.query(url, timeout=timeout)
File "/root/ringdownload/ring_doorbell/init.py", line 95, in query
return self.auth.query(
File "/root/ringdownload/ring_doorbell/auth.py", line 89, in query
req.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.ring.com/clients_api/dings/6957702442342281921/recording?api_version=9

@Gamerios
Copy link

if try again same url work but how can set that it automatic try it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment