• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

canning websites removing external dependency

I need to "can" a list of sites as in get a local copy and remove all external dependencies links so that I can use it in repeated tests and for it not to make any external requests or connections.
How do you recommend I go about doing this?
1 Solution
Replace all occurances of http://some-other-site by http://your-domain-name.
The following perl command might work

perl -i.bak -npe 's{https?://[^\/"\? ]+}{http://www.yourdomain.com}g' *.html

This will of course result in local but invalid links.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now