Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Created February 13, 2014 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loisaidasam/8986313 to your computer and use it in GitHub Desktop.
Save loisaidasam/8986313 to your computer and use it in GitHub Desktop.
Android Scraper - get info about an app in the Google Play Store
import argparse
import sys
from bs4 import BeautifulSoup
import requests
def main():
parser = argparse.ArgumentParser(description="Get info about an app in the Google Play Store")
parser.add_argument('-v', '--version', action='store_true')
parser.add_argument('url', help="URL (or namespaced id, like com.example.appname) of the app you want details about")
args = parser.parse_args()
url = args.url
if not url.startswith('http'):
url = "https://play.google.com/store/apps/details?id=%s" % url
response = requests.get(url)
if response.status_code != 200:
print >> sys.stderr, "Bad status code: %s" % response.status_code
return
if args.version:
soup = BeautifulSoup(response.content)
div = soup.find(itemprop="softwareVersion")
print div.string
return
print "OK"
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment