The open source GIScore library within the OpenSextant project has some methods to recursively fetch contents of a Network Link feature by feature using StAX (STreaming API for XML processing) to parse the KML.
Library is written in Java and has low-level methods to manage network link content, but you'd still need to implement the timers, etc. It does, however, transparently handle absolute and relative links within both KML and KMZ files such that a referenced KML file within a KMZ with a relative link will be traversed automatically.
URL url = new URL(...);
KmlReader reader = new KmlReader(url);
// read all features from KML
for (IGISObject gisObj; (gisObj = reader.read()) != null; ) {
// do something with the gis object; e.g. check for placemark, NetworkLink, etc.
}
// get list of network links that were retrieved from step above
List<URI> networkLinks = reader.getNetworkLinks();
if (!networkLinks.isEmpty()) {
// Now import features from all referenced network links.
// if Networklinks have nested network links then they will be added to end
// of the list and processed one after another. The handleEvent() callback method
// below will be called with each feature (i.e. Placemark, GroundOverlay, etc.)
// as it is processed in the target KML resources.
reader.importFromNetworkLinks(
new KmlReader.ImportEventHandler() {
public boolean handleEvent(UrlRef ref, IGISObject gisObj)
{
// if gisObj instanceOf Feature, GroundOverlay, etc.
// do something with the gisObj
// return false to abort the recursive network link parsing
return true;
}
});
}