Last active
January 24, 2018 22:57
-
-
Save binkybear/028989536a7a43053927 to your computer and use it in GitHub Desktop.
Download latest SuperSU (modified from: https://github.com/ebildude123/LatestRomUtil/blob/master/Python/latestromutil.py)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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