White scenery @showyou, hatena

If you have any comments, you may also send twitter @shsub or @showyou.

応答元を引き出す

自前ライブラリを使いまくってて理解できないとおもいますが、
一応こんな感じでいけたよーって報告。

# -*- coding: utf-8 -*-
def getChatLog():
	import time,json,twitter2,re,toDate,datetime
	file = open("user.dat",'r')
	userdata = json.read(file.read())
	file.close()
	
	tw = twitter2.Twitter(userdata)
	s = ""
	pageNum = 1 #ページ数。
	for i in range(pageNum):
		a = tw.getWithPage("showyou",i+1)
		for x in a:
			s += x[0]+':' + x[1] + '\n'
			
			# @(英数字)空白 -> user
			reg = re.compile('@(\S+)\s')
			match = reg.match(x[1])
			if match:
				replyUser = match.group(1)
				print "match:",
				print replyUser
				b = tw.getWithUser("showyou",replyUser)
				for y in b:
					if toDate.toDate(x[2]) - toDate.toDate(y[2]) >\
						datetime.timedelta(days =0) :
						s += ":reply: "+y[0]+':' + y[1] + '\n'
						break
	return s
	
print getChatLog()

実行結果例

showyou:@mas_fj 太るときに一気にどかんとくる
:reply: mas_fj:@showyou いまだに太らないんだけど……。
showyou:@smokeymonkey おやすみなさい
:reply: smokeymonkey:今日は体力回復日なので、ゆったり本読んで 22 時に寝ます。おやすみなさーい。

こんな感じにできたので、学習させていこうかと思いますです。