Exemplo n.º 1
0
def update_douban():
	douban_title = ''.join( (u'【教务处通知】', title,) )
	douban_text = pq(content).text()[:100]
	if multi_update.douban_new_recommendation(douban_title, douban_text, link):
		print 'Douban Update Succesful!'
		log.write( '%s - LilyBBS TOP10 - a new recommendation to douban\n' % (datetime.now(),) )
	else:
		print 'Douban Update Failed!!!'
		log.write( '%s - LilyBBS TOP10 - update douban recommendation failed!!!!!\n' % (datetime.now(),) )
Exemplo n.º 2
0
def update_douban(row,postid):
	if row['type']==0:
		title =u'【学术讲座预告】%s' % (row['post_title'])
		excerpt = u'时间:%s 地点:%s 主讲人:%s  --  %s' % (row['coming_date'][5:16], row['place'], row['speakers'], row['post_content'][:50], )
	elif row['type']==1:
		title =u'【校园活动预告】%s' % (row['post_title'])
		excerpt = u'时间:%s 地点:%s 主办:%s  --  %s' % (row['coming_date'][5:16], row['place'], row['display_name'], row['post_content'][:50], )
	else:
		title =u'【预告】%s' % (row['post_title'])
		excerpt = u'时间:%s 地点:%s  --  %s' % (row['coming_date'][5:16], row['place'], row['post_content'][:50], )
	if multi_update.douban_new_recommendation(title, excerpt[:100], postid2url(postid)):
		print 'Douban Update Succesful!'
		log.write( '%s - Leture | Activity - a new recommendation to douban\n' % (datetime.now(),) )
	else:
		print 'Douban Update Failed!!!'
		log.write( '%s - Leture | Activity - update douban recommendation failed!!!!!\n' % (datetime.now(),) )