, which raises a couple of things you may want to think about. You seem to have an idea about how you want this to work. With this in mind read
, here someone has a list of URLs they wish to visit/parse.
provides a detailed description of the how to deal with these situations, which may be of interest to you also.
and added a link to a previous question related to this topic.