How to check if ipfs url is image or video

there is no extension in ipfs url.
How to check if it is image or video.
Please help me if you have any idea.

If you fetch the URI using HTTP you might be able to inspect the response Content-Type header?