Update api.py

* Firmware update (?) broke file downloading. Changed how mediaServerID is found.
* Download URLs go beyond just 100 and 101, updated code to allow for up to 109 using regex.
Updated for pip8