def setWeiboMongo(rst):
db=get_db()
cl=db['retweet']
try:
maxMid=cl.find().sort("mid", pymongo.DESCENDING)[0]['mid']
except:
maxMid='0'
coll=[]
for c in rst:
dt={}
cm=re.findall('comment_txt.*?/p',c)[0]
dt['mid']=returnMid(c)
if dt['mid']<=maxMid:
break
dt['url']=returnUrl(c)
dt['friend']=returnFri(cm)
dt['retweet']=0
coll.append(dt)
if coll:
cid=cl.insert(coll)
print('insert',len(coll),' retweet document!')
return coll
评论列表
文章目录