tastypear

download apps from bazaarandroid directly

Apr 20th, 2012
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. #another foolish script from an idiot
  2.  
  3. from urllib import urlopen
  4.  
  5. #get the url of the page, then use this script to get the direct download link
  6. srcUrl="http://taz2781.bazaarandroid.com/app/market/com.koushikdutta.rommanager/3017/5498/ROM%20Manager" #test
  7.  
  8. splash=[0,0,0,0,0,0,0,0]
  9. def getSplashPos(nurl):
  10.     i = 0
  11.     splash[i]=0
  12.     while i!=8:
  13.         splash[i]=nurl.find('/',splash[i-1]+1)
  14.         i+=1
  15.        
  16. def get_mUrl(nurl):
  17.     getSplashPos(nurl)
  18.     str1="http://m."
  19.     str2=nurl[7:nurl.index(".bazaarandroid.com")+22]
  20.     str3=nurl[splash[6]:splash[7]]
  21.     str4=nurl[splash[4]:splash[5]]
  22.     print "Waiting for mirror..."
  23.     str5=urlopen(nurl).read()
  24.     print "Waiting for content..."
  25.     pos5=str5.index("softwareversion")
  26.     str5="/"+str5[pos5+17:str5.find("</span>",pos5)]
  27.     str6=nurl[nurl.rfind('/'):]
  28.     return str1+str2+str3+str4+str5+str6
  29.  
  30. def get_myapp(nurl):
  31.     myapp_content = urlopen(get_mUrl(nurl)).read()
  32.     print "Getting myapp file..."
  33.     myapp_pos_end = myapp_content.find(".myapp")+6
  34.     myapp_pos_begin = myapp_content.find("app_install")
  35.     myapp_pos_begin = myapp_content.find("http://",myapp_pos_begin)
  36.     myapp_url = myapp_content[myapp_pos_begin:myapp_pos_end]
  37.     return myapp_url
  38.  
  39. def get_apk(myapp_url):
  40.     apk_url = urlopen(myapp_url).read()
  41.     begin = apk_url.index("http://")
  42.     end = apk_url.index("</get>")
  43.     return apk_url[begin:end]
  44.  
  45. print get_apk(get_myapp(srcUrl))
  46. print "Done"
Add Comment
Please, Sign In to add comment