I've seen examples on how to download files programmatically, but they all use direct links, ending with .txt .mp3 .jpg, whatever. However, the link to the file I want to download isn't a direct link: it doesn't end with .extension. How can you download the file in this case?
Asked
Active
Viewed 1,472 times
0
-
@JoshM, an example is http://www.youtube-mp3.org/get?video_id=KMU0tzLwhbE&h=f2df8e9c5cd1834af6a8323a9965d161 – Xander Oct 14 '13 at 19:17
-
1Just download it as if it was any other type of file? – Josh M Oct 14 '13 at 19:19
-
The link now doesn't seem to work, I'll try to get the link working first. – Xander Oct 14 '13 at 19:20
-
The link works now, you mustn't press it, but copy and paste instead – Xander Oct 14 '13 at 19:22
-
@JoshM I feel so stupid, but you can actually download it as if it does have an extension. I'm sorry I haven't tried that first. – Xander Oct 14 '13 at 20:27
2 Answers
0
When downloading over HTTP, the file name is usually set by the server in Content-Disposition header. If that is not present, it is up to the client to choose the file name (based on the URL or some other strategy). The extension can often be derived from the Content-Type response header. See this for some of standard content types http://en.wikipedia.org/wiki/Internet_media_type

kkamenev
- 939
- 9
- 12
0
Very stupid answer: You can just download it as all other files. Download it the same way as you do with urls with extensions.

Xander
- 5,487
- 14
- 49
- 77