Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to copy a website, but I want to exclude specific HTML elements by ID or class in all pages (using a bash script).

I need this because I don't want ads or some other annoying features of some websites.

share|improve this question

This isn't a full answer, but it was too big for the comment box and I hope it puts you on the right track.

Stripping those things out while HTTrack is processing the files might be hard. They have a C API for plug-ins that seems to provide hooks you could use to strip out chunks of the document before HTTrack scans it for further URLs to download, but I don't see a scripting interface for that (someone else might have written one, though).

Stripping those things out after HTTrack has downloaded the files would be easier, but bash probably isn't the best choice here, because you'd have to spend a lot of time teaching bash how to parse HTML. You'd probably do better to use a more advanced scripting language that has good HTML/DOM libraries built-in or freely available (Perl, Python, Ruby, etc.).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.