[gentoo-user] download dynamic generated file using wget or curl
I want to download some jpg's whose URL is as http://some.site/show.php?id=100. In firefox, the downloaded filename is correctly as somefile.jpg, but if I download it using wget or curl, the downloaded file name is show.php?id=100, which is not acceptable. Can anyone give me a hint to use command line tool to download such kind of files with correct filename?-- Qiangning HongGet Firefox! http://www.spreadfirefox.com/?q=affiliatesamp;id=67907amp;t=1
Re: [gentoo-user] download dynamic generated file using wget or curl
Qiangning Hong wrote: I want to download some jpg's whose URL is as http://some.site/show.php?id=100. In firefox, the downloaded filename is correctly as somefile.jpg, but if I download it using wget or curl, the downloaded file name is show.php?id=100, which is not acceptable. Can anyone give me a hint to use command line tool to download such kind of files with correct filename? -- Qiangning Hong Get Firefox! http://www.spreadfirefox.com/?q=affiliatesamp;id=67907amp;t=1 http://www.spreadfirefox.com/?q=affiliatesamp;id=67907amp;t=1 wget -o filename.jpg http://some.site/show.php?id=100 -- [Name ] :: [Matan I. Peled] [Location ] :: [Israel] [Public Key] :: [0xD6F42CA5] [Keyserver ] :: [keyserver.kjsl.com] encrypted/signed plain text preferred signature.asc Description: OpenPGP digital signature
Re: [gentoo-user] download dynamic generated file using wget or curl
On Thu, 2005-04-21 at 17:45 +0800, Qiangning Hong wrote: I want to download some jpg's whose URL is as http://some.site/show.php?id=100. In firefox, the downloaded filename is correctly as somefile.jpg, but if I download it using wget or curl, the downloaded file name is show.php?id=100, which is not acceptable. Can anyone give me a hint to use command line tool to download such kind of files with correct filename? I think you're right, curl and wget don't support giving the file the correct file name. As a workaround, this line will give the server-suggested file name: curl -I $URL 2/dev/null | sed 's/Content-\(Type\|disposition\):.*\ \(file\)\?name=\(.*\).*$/\3/;ta;d;:a;q' You could then use: wget $URL -o $(curl -I $URL 2/dev/null | sed 's/Content-\(Type\| disposition\):.*\\(file\)\?name=\(.*\).*$/\3/;ta;d;:a;q') -- gentoo-user@gentoo.org mailing list