Retreive snapshot from camera and place it into some drive folder

21 views
Skip to first unread message

Andres Reyes

unread,
Jun 11, 2024, 12:47:11 PMJun 11
to Google Apps Script Community
Appreacite your help in helping me to know if it is possible. As you know from surveillance cameras, you can pull a snapshot from urls provided by manufacturers, in my case I have the following camera reachable at  http://root:ad...@10.10.1.11/axis-cgi/jpg/image.cgi
So from there I would like to pull that snapshot to a google drive folder. So I am trying something like this, but I am getting this error and not being table do what I need to. 

function saveCameraSnapshot() {
  var url = 'http://root:ad...@10.10.1.11/axis-cgi/jpg/image.cgi';
  var folderId = '19_9THIoHlyW5XJHH3XhQHdLyHXu30sO5'; 
 
  var response = UrlFetchApp.fetch(url);
  var blob = response.getBlob();
 
  var timestamp = new Date().toISOString().replace(/[:\-T]/g, '').slice(0, 15);
  var fileName = 'snapshot_' + timestamp + '.jpg';
 
  var folder = DriveApp.getFolderById(folderId);
  folder.createFile(blob).setName(fileName);
}

I also tried changing the url to my public ip doing some nat, but still getting the same error: 
Error
Exception: Login information disallowed: http://root:ad...@10.10.1.11:1048/axis-cgi/jpg/image.cgi



Web Dev

unread,
Jun 12, 2024, 2:33:02 AMJun 12
to Google Apps Script Community
Hi Andres. This seems to be a question with the immediate problem that is unrelated to GAS. You need to figure out how to access your end point via an API call that may require you to supply some additional data in `options` as an argument. Once you resolve that this group can help with GAS. Also, seems like you're on the right track with using `blob`.
Reply all
Reply to author
Forward
0 new messages