Score:0

How to follow links on a SPECIFIC webpage and analyse them recursively to download files using wget?

ru flag

I am trying to download audio files from a webpage using wget. I cannot get the command right. Let us say the files are on the page http://songs.com/artists/name/album/2020 On this page there are several albums each has its own link that leads you to another page where the links to the audio files exist. The links for these audio files might lead to another website, for e.g. http://music.com/song.mp3 I want wget to ONLY download the 2020 albums and place each album (i.e. link) on a separate file.

raj avatar
cn flag
raj
I'm not sure what do you mean by "ONLY download the 2020 albums and place each album (i.e. link) on a separate file". Wget is meant to re-create the structure of the webpage you are downloading, ie. you will start from main "2020" page, where you will have links to album pages, and from these pages links to audio files. Wget will download all these pages and audio files. There is no way to download only the audio files and skip the web pages, if that's what you want. You must write a separate script to do this.
ru flag
What I meant is that wget is downloading things that I don't want to download. For e.g 2019 albums which is on a different link. Regarding only downloading audio files my understanding is that adding - A mp3 will only download mp3 files.
raj avatar
cn flag
raj
So probably the page http://songs.com/artists/name/album/2020 , or any of the linked subpages, contains links to 2019 albums, otherwise wget wouldn't be able to find and download them. Without knowing the exact URLs, it is hard to say if there is any method to filter them out.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.