-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunwapple.py
63 lines (44 loc) · 1.27 KB
/
runwapple.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""single peek"""
import getopt
import sys
from app.wapple import Wapple
from speedy.speedydb import SpeedyDb
from speedy.peeky import Peeky
MONTHID = 36
THREAD_COUNT = 1
def checkSite(site):
siteId = site[0]
url = site[2]
print siteId, url
db = SpeedyDb()
wapple = Wapple()
answers = wapple.scan(url)
if answers is None or answers.__len__() == 0:
return
db.clearFeatures(siteId, MONTHID)
try:
for app in answers:
categories = ""
version = answers[app]["version"]
for cat in answers[app]["categories"]:
categories = cat["name"] + ","
print ">> {0:<20} {1: <30} {2: <6}".format(app, categories.strip(","), version)
db.saveFeatures(MONTHID, siteId, app, categories.strip(","), version)
except:
print 'failed: ', answers
# categories = ""
# version = thing["version"]
# for c in thing["categories"]:
# categories = c + ","
def CheckSites(sites, threads):
for site in sites:
checkSite(site)
pky = Peeky()
pky.goPeek(MONTHID)
pky.close()
def main(argv):
db = SpeedyDb()
sites = db.getSites()
CheckSites(sites, THREAD_COUNT)
if __name__ == '__main__':
main(sys.argv[1:])