예제 #1
0
def list(cat, ctr = None, nb_results = None, offset = None):
    api = GooglePlayAPI(ANDROID_ID)
    api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)
    try:
        message = api.list(cat, ctr, nb_results, offset)
    except:
        print "Error: HTTP 500 - one of the provided parameters is invalid"

    if (ctr is None):
        print SEPARATOR.join(["Subcategory ID", "Name"])
        for doc in message.doc:
            print SEPARATOR.join([doc.docid.encode('utf8'), doc.title.encode('utf8')])
    else:
        print_header_line()
        doc = message.doc[0]
        results = []
        for c in doc.child:
            results.append(get_parsed_result(c))
        return results
예제 #2
0
def list(cat, ctr=None, nb_results=None, offset=None):
    api = GooglePlayAPI(ANDROID_ID)
    api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)
    try:
        message = api.list(cat, ctr, nb_results, offset)
    except:
        print "Error: HTTP 500 - one of the provided parameters is invalid"

    if (ctr is None):
        print SEPARATOR.join(["Subcategory ID", "Name"])
        for doc in message.doc:
            print SEPARATOR.join(
                [doc.docid.encode('utf8'),
                 doc.title.encode('utf8')])
    else:
        print_header_line()
        doc = message.doc[0]
        results = []
        for c in doc.child:
            results.append(get_parsed_result(c))
        return results
예제 #3
0
cat = sys.argv[1]
ctr = None
nb_results = None
offset = None

if(len(sys.argv) >= 3):
  ctr = sys.argv[2]
if(len(sys.argv) >= 4):
  nb_results = sys.argv[3]
if(len(sys.argv) == 5):
  offset = sys.argv[4]

api = GooglePlayAPI()
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)
try:
  message = api.list(cat, ctr, nb_results, offset)
except:
  print "Error: HTTP 500 - one of the provided parameters is invalid"


if(ctr is None):
  print SEPARATOR.join(["Subcategory ID", "Name"])
  for doc in message.doc:
    print SEPARATOR.join([doc.docid.encode('utf8'), doc.title.encode('utf8')])

else:
  print_header_line()
  doc = message.doc[0]
  for c in doc.child:
    print_result_line(c)
예제 #4
0
class GoogleAnalysis(object):
    """docstring for GoogleAnalysis."""
    def __init__(self):
        super(GoogleAnalysis, self).__init__()
        self.api = GooglePlayAPI(ANDROID_ID)
        self.api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)

    def category_list(self):
        response = self.api.browse()
        return list(
            map(
                lambda c: SEPARATOR.join(
                    i.encode('utf8')
                    for i in [urlparse.parse_qs(c.dataUrl)['browse?cat'][0]]),
                response.category))

    def read_files(self, cate):
        with open(dirname(__file__) + '/resource_list/' + cate + '.txt',
                  'r') as f:
            for line in f.readlines():
                filename = line.strip()
                print Color.Green + '[!] Start:  ' + Color.NoCo + filename
                self.details(filename)

    def details(self, packageName):
        message = self.api.details(packageName).docV2
        result = {
            "docid": message.docid,
            "title": message.title,
            "creator": message.creator,
            "descriptionHtml": message.descriptionHtml,
            "offer": {
                "currencyCode": message.offer[0].currencyCode,
                "formattedAmount": message.offer[0].formattedAmount
            },
            "details": {
                "appDetails": {
                    "developerName": message.details.appDetails.developerName,
                    "versionCode": message.details.appDetails.versionCode,
                    "versionString": message.details.appDetails.versionString,
                    "contentRating": message.details.appDetails.contentRating,
                    "installationSize":
                    message.details.appDetails.installationSize,
                    # "permission": message.details.appDetails.permission,
                    "numDownloads": message.details.appDetails.numDownloads,
                    "packageName": message.details.appDetails.packageName,
                    "uploadDate": message.details.appDetails.uploadDate,
                }
            },
            "aggregateRating": {
                "starRating": message.aggregateRating.starRating,
                "ratingsCount": message.aggregateRating.ratingsCount,
                "oneStarRatings": message.aggregateRating.oneStarRatings,
                "twoStarRatings": message.aggregateRating.twoStarRatings,
                "threeStarRatings": message.aggregateRating.threeStarRatings,
                "fourStarRatings": message.aggregateRating.fourStarRatings,
                "fiveStarRatings": message.aggregateRating.fiveStarRatings,
                "commentCount": message.aggregateRating.commentCount
            }
        }

        doc = message
        vc = doc.details.appDetails.versionCode
        ot = doc.offer[0].offerType
        self.download(packageName, vc, ot)

        with open(
                dirname(abspath(__file__)) + '/detail_reports/' + packageName,
                'w') as f:
            json.dump(result,
                      f,
                      sort_keys=True,
                      indent=4,
                      separators=(',', ': '))
            f.close()
        # print json.dumps(result, sort_keys=True, indent=4, separators=(',', ': '))

    def download(self, packageName, vc, ot):
        data = self.api.download(packageName, vc, ot)

        with open(
                dirname(abspath(__file__)) + '/apk_files/' + packageName +
                '.apk', 'w') as f:
            f.write(data)
            print "Done"
            f.close()

    def test(self):
        lists = list('!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c')
        for i in lists:
            try:
                print self.api.list('ART_AND_DESIGN', 'apps_topselling_free',
                                    '1', 'CA' + i)
            except:
                print i
예제 #5
0
cat = sys.argv[1]
ctr = None
nb_results = None
offset = None

if (len(sys.argv) >= 3):
    ctr = sys.argv[2]
if (len(sys.argv) >= 4):
    nb_results = sys.argv[3]
if (len(sys.argv) == 5):
    offset = sys.argv[4]

api = GooglePlayAPI(ANDROID_ID)
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)
try:
    message = api.list(cat, ctr, nb_results, offset)
except:
    print "Error: HTTP 500 - one of the provided parameters is invalid"

if (ctr is None):
    print SEPARATOR.join(["Subcategory ID", "Name"])
    for doc in message.doc:
        print SEPARATOR.join(
            [doc.docid.encode('utf8'),
             doc.title.encode('utf8')])
else:
    print_header_line()
    doc = message.doc[0]
    for c in doc.child:
        print_result_line(c)
예제 #6
0
if (len(sys.argv) >= 4):
    nb_results = sys.argv[3]
if (len(sys.argv) == 5):
    offset = sys.argv[4]

if nb_results == None:
    nb_results = 20

api = GooglePlayAPI(ANDROID_ID)
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)

n = 0
while (n < nb_results):
    if n == 0:
        n += 20
        message = api.list(cat, ctr, '20', offset)
        if message == False:
            print "Error: HTTP 500 - one of the provided parameters is invalid"
            exit(1)
    else:
        time.sleep(2)
        message = api.getNextPage(nextPageUrl)
        if message == False:
                print 'error or no more app'
                break
    doc = message.doc[0]
    nextPageUrl = doc.containerMetadata.nextPageUrl

    if (ctr is None):
        print SEPARATOR.join(["Subcategory ID", "Name"])
        for doc in message.doc:
예제 #7
0
    'apps_topgrossing',
    'apps_topselling_new_paid',
    'apps_topselling_new_free'
)

count = 0
duplicated = 0
offset = 100
logger.info('Using offset {}'.format(offset))

for sub in SUB_CAT:
    index = 0

    while(True):
        try:
            message = api.list('SOCIAL', sub, str(offset), str(index * offset))
            try:
                doc = message.doc[0]
            except IndexError:
                logger.critical(
                    "Slice {}+ failed to fetch for category {} and subcat {}"
                    .format(index * offset, "SOCIAL", sub))
                break

            for c in doc.child:
                logger.debug(
                    'Fetching app id {}, version {} and date {}'.format(
                        c.docid,
                        c.details.appDetails.versionCode,
                        c.details.appDetails.uploadDate
                    ))
예제 #8
0
packagename = sys.argv[1]
filename = None
nb_results = None
offset = None

if (len(sys.argv) >= 3):
    filename = sys.argv[2]
if (len(sys.argv) >= 4):
    nb_results = sys.argv[3]
if (len(sys.argv) == 5):
    offset = sys.argv[4]

api = GooglePlayAPI(ANDROID_ID)
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD)
try:
    message = api.list(packagename, filename, nb_results, offset)
except:
    print "Error: HTTP 500 - one of the provided parameters is invalid"

if (filename is None):
    print SEPARATOR.join(["Subcategory ID", "Name"])
    for doc in message.doc:
        print SEPARATOR.join(
            [doc.docid.encode('utf8'),
             doc.title.encode('utf8')])
else:
    topline()
    doc = message.doc[0]
    i = 0
    for c in doc.child:
        ia = app_info(c)