Getting filename from the download URL

Folks, we’re trying to use the API to download the resulting video files but we’re having an issue assigning the proper filename.

Looking at the headers of download request for a vtt file we see:
Content-Disposition: attachment;filename=…

For video files we see:
Content-Disposition: attachment

Is that due to a redirect? We see what looks like the filename in the Location header.
Location: https://ssrweb.zoom.us/cmr/replay

Any suggestions as to how to download the file w/the correct filename?

Hey @kchan,

Please share what endpoint you are using, as well as steps to reproduce the issue.

When you say filename, what do you mean? The download_url? Can you please share the download URL you are trying to use (feel free to private message it to me).

What is your use case for getting the filename from the URL?

Thanks,
Tommy

Yeah, that’s it. Ultimately we need to know the filename so we could reference it later and associate it with the meeting owner.

I was hoping to find an alternative to grepping the header (in different ways based on type of file) to assign a name of file. I guess web browsers are smarter at parsing through the headers coming across, offering a correct name to do the save as …

Hey @kchan,

This stackoverflow answer might help:

Thanks,
Tommy

It mentions
If you want to preserve the original file name from the remote server, use the -O option.

e.g. ```
curl -O http://url.com/file.html

Doing a 
curl -O -L https://hawaii.zoom.us/rec/download/uZIvJu-h-z03EtHDsgSDAadxW9S5f6Os1ihL__cOmRvkVCVVOgKlbrAbard68ha8UjTsTkS6wGINKiPA

results in a saved file named 'uZIvJu-h-z03EtHDsgSDAadxW9S5f6Os1ihL__cOmRvkVCVVOgKlbrAbard68ha8UjTsTkS6wGINKiPA'

so now I realize that -O is naming  'uZIvJu-h-z03EtHDsgSDAadxW9S5f6Os1ihL__cOmRvkVCVVOgKlbrAbard68ha8UjTsTkS6wGINKiPA' .. cause that's the "named" filename from the download URL.

Hey @kchan,

Nice catch. You could also rename that if you needed to.

Did you accomplish what you needed?

Thanks,
Tommy

Did you accomplish what you needed?

Not really. I’ll need to make one curl request to download the headers from the download URL, parse it to get the info we need (the real name of file), then do another fetch to download and correctly name the file. Maybe I could do it in one fetch, but it’s still hunt for the filename then rename.

Hey @kchan,

I see, can you use the cloud recording id property in the cloud recording API or webhook to rename the file?

Thanks,
Tommy

@kchan quote=“tommy, post:8, topic:8502”]
Is there a way to give a specific file name when saving a file via cURL?
[/quote]
@kchan
I am trying to do the same but when i read the headers i don’t get the file name, getting a lot of other info. Can you please share your code that is used to get the original Zoom file name.
Thanks in advance

Hey @kchan,

Have you tried this stack overflow answer to come up with your own file naming convention?

Thanks,
Tommy

Sorry for the late reply. I forgot my question was still floating out there. We’re still finding out the filename via headers. I vaguely remember that we need to do two different approaches (searching) based on the kind of file.

However the issue that I had about not having the correct headers, initially was due to authentication. For most things we’d send authentication as part of the header packet (instead of part of the URL). For downloads you don’t include authentication as part of the header packet.

1 Like

Thanks for the info @kchan! :slight_smile:

-Tommy