当前位置: 首页>>代码示例>>Python>>正文


Python GooglePlayAPI.reviews方法代码示例

本文整理汇总了Python中googleplay.GooglePlayAPI.reviews方法的典型用法代码示例。如果您正苦于以下问题:Python GooglePlayAPI.reviews方法的具体用法?Python GooglePlayAPI.reviews怎么用?Python GooglePlayAPI.reviews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在googleplay.GooglePlayAPI的用法示例。


在下文中一共展示了GooglePlayAPI.reviews方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GooglePlayAPI

# 需要导入模块: from googleplay import GooglePlayAPI [as 别名]
# 或者: from googleplay.GooglePlayAPI import reviews [as 别名]
#packageName = "com.WiredDFW.DIRECTV.unWiredRemoteLite" #Default value
#packageName = "com.happybug.livewallpaper.jellyfishlite"
print "Nextline:", packageName
filterByDevice=False
sort=0


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

#response = api.reviewById(packageName, filterByDevice, ID)
#print response
for s in range(4):
    sort = s
    for m in range(MAX_RESULTS/NB_RES):
        response = api.reviews(packageName, filterByDevice, sort, str(NB_RES),str(m*NB_RES))
#        print response
        for n in range(NB_RES):
            try:
                c = response.getResponse.review[n]
                l = [  

                           c.documentVersion,
                           
                           c.timestampMsec,

                           c.starRating,
                           c.title,
                           c.comment,
                           c.commentId,
开发者ID:tyunist,项目名称:google-play-crawler,代码行数:32,代码来源:getReviewsViaCMD.py

示例2: int

# 需要导入模块: from googleplay import GooglePlayAPI [as 别名]
# 或者: from googleplay.GooglePlayAPI import reviews [as 别名]
if (len(sys.argv) < 2):
    print "Usage: %s request [package] [offset]" % sys.argv[0]
    print "Returns 20 reviews for a given app package."
    sys.exit(0)

request = sys.argv[1]
nb_res = 20
offset = 0

if (len(sys.argv) >= 3):
    offset = int(sys.argv[2])

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

try:
    reviews = api.reviews(request, False, 0, nb_res, offset)
except:
    print "Error: something went wrong. Maybe the nb_res you specified was too big?"
    sys.exit(1)

resp = reviews.getResponse
print_header_line()
try:
	for c in resp.review:
	    if c != None:
	        print_result_line(c)
except Exception,e:
	print e

开发者ID:alexanderlz,项目名称:googleplay-api,代码行数:31,代码来源:reviews.py

示例3: getReviews

# 需要导入模块: from googleplay import GooglePlayAPI [as 别名]
# 或者: from googleplay.GooglePlayAPI import reviews [as 别名]
def getReviews(packageName,pip):
    NB_RES = 20;
    MAX_RESULTS = 500;
    #packageName = "com.WiredDFW.DIRECTV.unWiredRemoteLite" #Default value
    #packageName = "com.happybug.livewallpaper.jellyfishlite"
    print "Nextline:", packageName
    filterByDevice=False
    sort=0


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

    #response = api.reviewById(packageName, filterByDevice, ID)
    #print response
    for s in range(4):
        sort = s
        time.sleep(3)
        for m in range(MAX_RESULTS/NB_RES):
            time.sleep(1)
            response = api.reviews(packageName, filterByDevice, sort, str(NB_RES),str(m*NB_RES),pip=pip)
    #        print response
            for n in range(NB_RES):
                try:
                    c = response.getResponse.review[n]
                    l = [  
                               
                               c.documentVersion,
                               
                               c.timestampMsec,
                               
                               c.starRating,
                               c.title,
                               c.comment,
                               c.commentId,
                               
                               c.deviceName,
#                               c.replyText,
#                               c.replyTimestampMsec, 
                               ]

                    #Check whether comment exists
                    fileName = "%d.%s.csv" %(s,packageName)
                    openfile = open(fileName,"a+")
                  
                    previousFileName = "previous.%s.csv" %packageName 
                    openPreviousFile = open(previousFileName,"a+")
                  
                    if hasInFile(openfile,c.commentId, c.timestampMsec) or hasInFile(openPreviousFile,c.commentId,c.timestampMsec):
                        openfile.close()
                        openPreviousFile.close()
                        continue
                    else:
                        print "There is new review of s = %d m = %d n = %d" %(s,m,n)
                        saveFile = open(fileName, "a+b")
                        savePreviousFile = open(previousFileName, "a+b")
                        wpb = UnicodeWriter(savePreviousFile)
                        wb = UnicodeWriter(saveFile)
                        k = []

                        for i in range(len(l)):
                            if isinstance(l[i], basestring):
                                if isinstance(l[i],unicode):
                                    l[i] = l[i].encode("utf-8")
                                    l[i] = removeSpecialKey(l[i])
        #                            print i
        #                            print type(l[i])
        #                            print l[i]
                            k = k  + [l[i]]            
                        wb.writerow(k)
                        wpb.writerow(k)
                        saveFile.close()
                        savePreviousFile.close()
                except IndexError:
                    print IndexError
                    break
            print "Getting %d to %d ..." %(m*20,(m+1)*20)
开发者ID:tyunist,项目名称:google-play-crawler,代码行数:79,代码来源:getReviews.py

示例4: int

# 需要导入模块: from googleplay import GooglePlayAPI [as 别名]
# 或者: from googleplay.GooglePlayAPI import reviews [as 别名]
# Dealing with user's parameter
appname = sys.argv[1]
if (len(sys.argv) == 3):
    maxNumReviews = int(sys.argv[2])
    # if specified value is >500, set it to 500 (maximum value).
    if maxNumReviews > 500:
        maxNumReviews = 500
# if not specified, set the number of reviews to 500 (default value).
else:
    maxNumReviews = 500


# ignore unverified HTTPS request warning.
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

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

# Each request returns 20 reviews.
# Loop until you find no more or reach the limit of 500
for offsetNum in range(0, maxNumReviews, 20):
    reviewResponse = api.reviews(appname, offset=offsetNum)
    print text_format.MessageToString(reviewResponse.getResponse)
    # if nextPageUrl is not present in response, there are no reviews left 
    if not reviewResponse.nextPageUrl:
        break


开发者ID:gorla,项目名称:googleplay-api,代码行数:29,代码来源:reviews.py


注:本文中的googleplay.GooglePlayAPI.reviews方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。