Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #for win
- #python + curl
- import urllib2
- import os
- local = "D:\\apks\\"
- logoWidth = 124 #MAX 512
- imgNum = 2 #Based on app
- url = raw_input("play Uri\n")
- def getPkgName(url):
- pkgNameB = url.index("=")+1
- if '&' in url:
- pkgNameE = url.index('&')
- else:
- pkgNameE = len(url)
- return url[pkgNameB:pkgNameE]
- def getUrl(pkg):
- return "http://play.google.com/store/apps/details?id=" + pkg + "&hl=en"
- def getContent(url):
- return urllib2.urlopen(url).read()
- def getVer(content):
- verB = content.index("softwareVersion")+17
- verE = content.find("<",verB)
- return content[verB:verE]
- def getLogo(content):
- logoB = content.index("doc-banner-icon")+27
- logoE = content.find("=",logoB)
- return (content[logoB:logoE] + "=w" + repr(logoWidth)).replace("https","http")
- def getSys(content):
- sysB = content.find("<dd>",content.index("operatingSystems"))+4
- sysE = content.find("</dd>",sysB)
- return content[sysB:sysE]
- def getCat(content):
- catB = content.find("<dd>",content.index("Category:"))+4
- catB = content.find(">",catB)+1
- catE = content.find("</a>",catB)
- return content[catB:catE].replace("&","&")
- def getPrice(content):
- priceB = content.index("buy-button-price")+16
- priceB = content.find(">",priceB)+1
- priceE = content.find("span>",priceB)-2
- return content[priceB:priceE].replace(" Buy","").replace("Install","$0")
- def getImg(content):
- sliceB = content.index("screenshot-carousel-content-container")+39
- sliceE = content.find("screenshot-carousel-right-fade",sliceB)-78
- imgContainer = content[sliceB:sliceE]
- imgContainer = imgContainer.split("=h")
- result = []
- i = 0
- while( i < len(imgContainer)):
- if "data-baseUrl=" in imgContainer[i]:
- posB = imgContainer[i].index("data-baseUrl=")+14
- posE = imgContainer[i].index("title")-2
- result.append((imgContainer[i][posB:posE]).replace("https","http"))
- i = i+1
- return result
- def getTitle(content):
- titleB = content.index("<h1 class=\"doc-banner-title\">")+29
- titleE = content.find("</h1>",titleB)
- return content[titleB:titleE]
- pkgName = getPkgName(url)
- content = getContent(getUrl(pkgName))
- title = getTitle(content)
- apkdir = local + title
- os.system("mkdir " +"\""+apkdir +"\"")
- logo = getLogo(content)
- os.system(local+"curl.exe -o \"" + apkdir +"\\logo.png\" "+ logo)
- img = getImg(content)
- i = 0
- while( i < len(img)):
- os.system(local+"curl.exe -o \"" + apkdir +"\\pic"+ repr(i) + ".png\" "+ img[i])
- i = i+1
- #os.system('cls')
- cat = getCat(content)
- sys = getSys(content)
- ver = getVer(content)
- price = getPrice(content)
- print title
- print cat
- print sys
- print pkgName
- print ver
- print price
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement