本文整理匯總了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,
示例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
示例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)
示例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