forked from egirault/googleplay-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulkSearch.py
More file actions
42 lines (32 loc) · 1.02 KB
/
bulkSearch.py
File metadata and controls
42 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
# Do not remove
GOOGLE_LOGIN = GOOGLE_PASSWORD = AUTH_TOKEN = None
import sys
from pprint import pprint
from config import *
from googleplay import GooglePlayAPI
from helpers import sizeof_fmt, print_header_line, print_result_line, print_result_json
if (len(sys.argv) < 2):
print "Usage: %s request [nb_results] [offset]" % sys.argv[0]
print "Search for an app."
print "If request contains a space, don't forget to surround it with \"\""
sys.exit(0)
requests = sys.argv[1].split(";")
nb_res = None
offset = None
if (len(sys.argv) >= 3):
nb_res = int(sys.argv[2])
if (len(sys.argv) >= 4):
offset = int(sys.argv[3])
api = GooglePlayAPI(ANDROID_ID)
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)
for request in requests:
try:
message = api.search(request, nb_res, offset)
except:
continue
# print if nothing wrong
if hasattr(message, "doc") and len(message.doc) > 0:
doc = message.doc[0]
for c in doc.child:
print_result_json(c)