Direct download URL support + global variable refactoring

CC @dragotin @ogoffart