Skip to content

Instantly share code, notes, and snippets.

@binkybear
Last active January 24, 2018 22:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save binkybear/028989536a7a43053927 to your computer and use it in GitHub Desktop.
Save binkybear/028989536a7a43053927 to your computer and use it in GitHub Desktop.
import urllib2
import urllib
class LatestSU:
def __getPage(self, url, retRedirUrl = False):
try:
bOpener = urllib2.build_opener()
bOpener.addheaders = [("User-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36")]
pResponse = bOpener.open(url)
if retRedirUrl == True:
return pResponse.geturl()
else:
pageData = pResponse.read()
return pageData
except Exception:
return ""
def dlSuperSU(self):
getUrl = self.__getPage("http://download.chainfire.eu/supersu", True)
latestUrl = getUrl + "?retrieve_file=1"
return latestUrl
# below is example usage
ldclass = LatestSU()
print "Latest SuperSU: " + ldclass.dlSuperSU()
print "Downloading to LatestSuperSU.zip"
urllib.urlretrieve (ldclass.dlSuperSU(), "LatestSuperSU.zip")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment