get_url with alternative url

i got a local cache to store files to download from when im deploying for our production environment thats internal to that network and for that im using get_url to download stuff.
But there are times when that local cache is not available and i need to download my stuff from other locations (i.e. the internet).

I could have two steps that

  1. try and download from the internal cache
  2. if (1) fails, download from the original

but that seems a bit repetitive.

Im not sure if there is another solution for this, but i was thinking maybe i could get get_url to accept an “alternative_url” and try that if the primary fails ?

I’d like to hear some input from anyone that is facing similar problems before re-inventing the wheel.

Cheers,
Mike