Closed jryd closed 5 years ago
I noticed this problem too when I tried the library. I did not look long, but suspected that it was because a.get
set's a bunch of headers (that aren't needed -- we are now fetching directly from an S3 bucket not Arlo) including (I believe) a wrong content type header.
@dougnd spot on. I used a generic http.Get() with the presigned content URL and it works perfectly. I've submitted a pull request to fix this, however if you want to get this going in the meantime, here's my fix in action with the library in its current state (just replace arlo.DownloadFile
with this:
// Create the file
out, err := os.Create(fmt.Sprintf("%s_%s.mp4", time.Unix(0, recording.UtcCreatedDate*int64(time.Millisecond)).Format(("2006-01-02_15.04.05")), recording.UniqueId))
if err != nil {
log.Fatal(err)
}
defer out.Close()
// Get the data
resp, err := http.Get(recording.PresignedContentUrl)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
// Write the body to file
_, err = io.Copy(out, resp.Body)
if err != nil {
log.Fatal(err)
}
I'm using a slightly modified version of the example script in the readme:
However, when I run it, it creates the recording file, but then I get a 404 error:
NOTE: I have edited the signature to make the recording URL invalid (privacy reasons) - however opening the link in my browser downloads the file.
Am I missing something here? All the videos result in a 404.