Beispiel #1
0
	def get_thread(bbs,thread_key):
		thread = MappingThreadId.mapping(bbs,thread_key)
		if(thread == None):
			return None
		
		MappingThreadId.assign(bbs,thread,True)
		return thread
Beispiel #2
0
	def get_thread_list(self,analytics):
		start_date=str(datetime.date.today()+datetime.timedelta(days=-1))
		end_date=str(datetime.date.today())
		result=analytics.get("page",".*",start_date,end_date)

		thread_list=[]
		for one in result:
			url=one["ga:pagePath"]
			count=int(one["ga:pageviews"])

			data=url.split("/")
			try:
				bbs_name=str(data[1])
				thread_name=str(data[2].split(".")[0])
			except:
				continue

			bbs_key=MappingId.mapping(bbs_name)
			bbs=ApiObject.get_cached_object(bbs_key)
			if(not bbs):
				continue
			thread = MappingThreadId.mapping(bbs,thread_name)
			if(not thread):
				continue

			while(count>=1):
				thread_list.append(thread.key())
				count=count-1

		return thread_list