linux - Download file with the name from last part of directory referred instead of real file name using wget or curl(Wget is prefered) -


lets say,

http://mobile.example.com/vid/flying-birds page on link http://mobile.example.com/vid/22 exist, when click on link, redirects http://v-cdn-r.example.com/mp4/x/y/dfile.mp4?ir=880&int=06 , file name dfile.mp4?ir=880&int=06 downloaded.

i want have file name flying-birds (from first page url). have tried doing wget function,

--default-page=name 

with command

wget -r -l1 --default-page=name http://mobile.example.com/vid/flying-birds 

but downloaded file name 22 (from 2nd link) instead of expected flying-birds

i have more 1 links , each link has different keywords flying-birds. in simple, there lots of directory different-different directory name.

you can try that:

wget -r -l1 -o $(basename http://mobile.example.com/vid/flying-birds) http://mobile.example.com/vid/flying-birds 

see post how wget file correct name when redirected?.


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -