I want to get the extensions of a few files from their download links.
Download links does not contain the extensions of their files. For example, a link looks like below:
http://yourshot.nationalgeographic.com/u/fQYSUbVfts-T7odkrFJckdiFeHvab0GWOfzhj7tYdC0uglagsDNfNYI4FFesWV5zeSPtcfpyHzKZI7dHjkluwtIYNkXOGmjh43Ktdn0VeBWhQ-9l2kheOPt5N2TM3yPEW4tTrtFFqniatwxxhbqsc78IU2pBaqWwyEVLeQx64zSda2CNGmUpSxyte_tamVoIk3y4zXisQ-vjmMp6n1BAB3nbUVlwWg/
I tried to get the files extension using myHttpUrlConnection.getContentType()
, but the result was not the result what I want.
Some download links return a phrase like “text/plain”
, ”application-octet-stream”
,multipart/form-data
,…
. But I just want correct and clear type, like rar
, mp4
, txt
, jpeg
,mkv
, zip
, png
, apk
, mp3
, …
.