I can do with pure js. Do you want?
Something very simple , 100% compatible with any browser.
var number = getDocumentById("input")
var folder = ////slice number
Then some function calling https//...../folder/number
I know nothing about this, so I can't really judge if this is good or not.