Advertisement
Guest User

Untitled

a guest
Dec 12th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1.  
  2. import urllib2
  3. from bs4 import BeautifulSoup
  4. import csv
  5.  
  6. pkg = "com.mavdev.focusoutfacebook"
  7. url = "https://play.google.com/store/apps/details?id=" + pkg
  8.  
  9. def get_app_lastupdate(pkg):
  10.     url = "https://play.google.com/store/apps/details?id=" + pkg
  11.     html = urllib2.urlopen(url).read()
  12.     soup = BeautifulSoup(html, 'html.parser')
  13.     appTitle = soup.find("div", {"class": "document-title"}).text
  14.     date = soup.find("div", {"itemprop": "datePublished"})
  15.     downloads = soup.find("div", {"itemprop": "numDownloads"})
  16.  
  17.     rating_count = soup.find("span",{'class':'rating-count'}).text
  18.    
  19.     appDict = dict()
  20.     appDict['lastUpdaDate'] = date.text
  21.     appDict['name'] = appTitle
  22.     appDict['downloadCnt'] = downloads.text
  23.     appDict['rating_count'] = rating_count
  24.  
  25.     return appDict
  26.  
  27. lastUpdate = get_app_lastupdate(pkg)
  28.  
  29. print lastUpdate['name']
  30. print lastUpdate['lastUpdaDate']
  31. print lastUpdate['downloadCnt']
  32. print lastUpdate['rating_count']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement