def userd(): i = 0 data = Data() while True: userid = data.outputusers() if userid == None: print "userd \t%s \tno job!" % userid time.sleep(5) continue else: userid = userid["_id"] print "userd \t%s \t" % userid try: userdd = UserReview(userid) except Exception, ex: print "userd", ex data.changeuseridstauts(userid) continue for item in userdd.getItemUrl(): data.insertitemid(item) # print item doc = userdd.getDoc() data.insertUser(doc) i += 1
def itemdetail(): data = Data() i = 0 while True: mid = data.outputitems("itemdetail") if mid == None: print "itemdetail\t%s \tno job!" % mid time.sleep(5) continue else: mid = mid["_id"] print "itemdetail\t%s \t" % mid # print url # soup = BeautifulSoup(dirver.page_source) try: itemd = ItemDetail(mid) except Exception, ex: print "itemdetail", ex data.changeitemidstauts(mid, "itemdetail") continue for item in itemd.realteitem: data.insertitemid(item) doc = itemd.getDoc() data.insertItem(doc) i += 1