Everything I'm finding is based on URL, but I want the opposite.

I have an html index with a list of links. The links are named like Apples, oranges, grapes, bananas. The files associated with those are like SID564065.zip, each with a different corresponding number. The links follow a few redirects before getting to their final destination, and from my understanding, that prevents me from using content-disposition. (Correct me if that is wrong)

I'm looking for something like a feature youtube-dl has, where a file can be named all kinds of ways by specifying -o '%(title)s.%(ext)s'

I know wget is not youtube-dl. I'm trying to find a way to make wget name the files based on the link name- The actual text that is found between the HTML anchor tags.

I have access to the initial HTML page that lists all of the files, but do not have access to the final server. A big file rename isn't feasible. If there is something I can add to the HTML(metadata to each link?) to assist wget in it's duties, I am able to do so.

Manually making a list of links is also not feasible. I need a wget one liner that will download all of the files on the page listing.

I am open to outside the box ideas, as long as the end result is that someone would be able to wget -rHnp(or similar) my page and be able to download all the files with the correct names.

EDIT: I haven't gotten very far into trial and error, as I've been reading man wget and haven't found much worth trying.

The best I could maybe think to do, which is certainly not ideal, is to specify an input file that I host, like a database, and try to do some kind of naming like that. I don't think that's a good idea, because the size of that would get out of hand quickly.

EDIT 2: The html pages that have these lists of links will be hosted on Github Pages, so not a full blown server where I can install things like jquery and node. Just a heads up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.