(While we're at it, there's no need for an apostrophe when pluralising an initialism, like "URLs".)
Please read posts fully before replying:
For reference, a hand-written script satisfying the above (excluding comments for brevity) ...