in between days

表参道で働くシニアのブログ

backup_mixiのパッチ

追記 2006-10-17

コメント欄でさらにパッチの改良が進められているようです。

http://d.hatena.ne.jp/kusigahama/19700831#c

それにしても、はてなダイアリーのコメント欄はホントに議論に向いていないし、そもそもこの日のダイアリーをアンテナに登録しているのだけど議論がアンテナで追えないのは何故かっちゅうか。

以下はこのエントリのオリジナル投稿ですがもう内容が古い

http://d.hatena.ne.jp/kusigahama/19700831#c1159742803 で公開されてた。

diff -Nur backup_mixi.orig/create_index.rb backup_mixi/create_index.rb
--- backup_mixi.orig/create_index.rb	2005-11-30 16:56:24.000000000 +0900
+++ backup_mixi/create_index.rb	2006-10-01 17:07:35.000000000 +0900
@@ -149,7 +149,7 @@
 				id, name = r[1 .. 2]
 
 				next unless r=match("date", body,
-					 /(2[0-9][0-9][0-9])年([0-9]?[0-9])月([0-9][0-9])日[  ]*([0-9][0-9])[::]([0-9][0-9])/ )
+					 /(2[0-9][0-9][0-9])年([0-9]?[0-9])月([0-9][0-9])日[  ]*([0-9]?[0-9])[::時]([0-9]?[0-9])分?/ )
 				date = Time.mktime(r[1].to_i, r[2].to_i, r[3].to_i, r[4].to_i, r[5].to_i)
 				
 				next unless r=match("title", body, /件[  ]*名\:?([^<]+)</)
diff -Nur backup_mixi.orig/mixi.rb backup_mixi/mixi.rb
--- backup_mixi.orig/mixi.rb	2005-08-31 15:24:08.000000000 +0900
+++ backup_mixi/mixi.rb	2006-10-01 17:05:53.000000000 +0900
@@ -10,7 +10,7 @@
 		"\<\/td\>[\r\n]*\<td\>([^\<]*)\<\/td\>")
 
 	DIARY_LIST_RE = Regexp.new(
-		'\>([0-9]+月[0-9]+日)\<br\>([0-9\:]+)\<\/font\>\<\/td\>[\r\n]*\<td[^\;]*\;([^\<]*)\<\/td\>')
+		'\>([0-9]+月[0-9]+日)\<br\>([0-9\:]+)\<\/font\>\<br\>\<input.+?\"\>\<\/td\>[\r\n]*\<td[^\;]*\;([^\<]*)\<\/td\>')
 
 	DIARY_NEXT_RE = Regexp.new(
 		'\<a href\=\"(view_diary.pl.id\=([0-9a-z]+)&owner_id=([0-9]+))\"\>続きはこちら\<\/a\>')
@@ -26,7 +26,7 @@
 	IMG_IN_DIARY_RE = Regexp.new('\"javascript\:void.*?show_picture\.pl.img_src\=[\'\"]?' + 
 		'(http://[a-zA-Z0-9_\.]+\.mixi\.jp\/([^\'\" \>]+\.(jpg|jpeg|gif|png)))[^\"]+\"' )
 		
-	FORM_RE = Regexp.new '\<form action\=.?(add_comment|delete_message|reply_message).+?\<\/form\>'
+	FORM_RE = Regexp.new '((\<form action\=.?(add_comment|delete_message|reply_message).+?\>)|(\<input (?:[^\"\'\>]|\"[^\"]*\"|\'[^\']*\')*\>)|(\<\/form\>)|(\<ahref\=\"spam message.pl\?message_id\=.+?&box\=inbox\"\>.+?\<\/a\>))'
 
 	ALERT_RE = Regexp.new '制限'
 	ALERT_SIZE = 768