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