* mixi.el (mixi-my-id-regexp): Follow the change of mixi.
[elisp/mixi.git] / mixi.el
diff --git a/mixi.el b/mixi.el
index 1965551..df86bdc 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -1,6 +1,6 @@
-;; mixi.el --- API libraries for accessing to mixi
+;; mixi.el --- API libraries for accessing to mixi -*- coding: euc-jp -*-
 
-;; Copyright (C) 2005,2006 OHASHI Akira
+;; Copyright (C) 2005, 2006, 2007, 2008, 2009 OHASHI Akira
 
 ;; Author: OHASHI Akira <bg66@koka-in.org>
 ;; Keywords: hypermedia
@@ -18,9 +18,9 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, you can either send email to this
-;; program's maintainer or write to: The Free Software Foundation,
-;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;;  * mixi-get-friends
 ;;  * mixi-get-favorites
 ;;  * mixi-get-logs
+;;  * mixi-get-self-logs
+;;  * mixi-get-recommended-friends (indies)
 ;;  * mixi-get-diaries
 ;;  * mixi-get-new-diaries
 ;;  * mixi-search-diaries
 ;;  * mixi-get-communities
 ;;  * mixi-search-communities
+;;  * mixi-get-recommended-communities (indies)
 ;;  * mixi-get-bbses
 ;;  * mixi-get-new-bbses
 ;;  * mixi-search-bbses
 ;;  * mixi-get-comments
 ;;  * mixi-get-new-comments
+;;  * mixi-get-new-bbs-comments
 ;;  * mixi-get-messages
-;;  * mixi-get-introductions
+;;  * mixi-get-introductions (broken)
 ;;  * mixi-get-news
+;;  * mixi-get-releases
+;;  * mixi-get-echoes (limited)
+;;  * mixi-get-new-echoes (limited)
 ;;
 ;; APIs for posting:
 ;;
 ;;  * mixi-post-topic
 ;;  * mixi-post-comment
 ;;  * mixi-post-message
+;;  * mixi-post-echo (limited)
 ;; 
 ;; Utilities:
 ;;
-;;  * mixi-remove-markup
+;;  * mixi-remove-markup (half broken)
 
 ;; Examples:
 ;;
 ;;       (buffer (get-buffer-create "*temp*"))
 ;;       (format "%Y/%m/%d %H:%M"))
 ;;   (pop-to-buffer buffer)
-;;   (mapc (lambda (diary)
-;;       (let ((subject (mixi-diary-title diary))
-;;             (from (mixi-friend-nick (mixi-diary-owner diary)))
-;;             (date (format-time-string format (mixi-diary-time diary)))
-;;             (body (mixi-remove-markup (mixi-diary-content diary))))
-;;         (insert "From: " from "\n"
-;;                 "Subject: " subject "\n"
-;;                 "Date: " date "\n\n"
-;;                 body "\n\n")))
-;;     (mixi-get-new-diaries range))
+;;   (let ((diaries (mixi-get-new-diaries range)))
+;;     (while diaries
+;;       (let* ((diary (car diaries))
+;;          (subject (mixi-diary-title diary))
+;;          (from (mixi-friend-nick (mixi-diary-owner diary)))
+;;          (date (format-time-string format (mixi-diary-time diary)))
+;;          (body (mixi-remove-markup (mixi-diary-content diary))))
+;;     (insert "From: " from "\n"
+;;             "Subject: " subject "\n"
+;;             "Date: " date "\n\n"
+;;             body "\n\n"))
+;;       (setq diaries (cdr diaries))))
 ;;   (set-buffer-modified-p nil)
 ;;   (setq buffer-read-only t)
 ;;   (goto-char (point-min)))
 ;;       (buffer (get-buffer-create "*temp*"))
 ;;       (format "%Y/%m/%d %H:%M"))
 ;;   (pop-to-buffer buffer)
-;;   (mapc (lambda (diary)
-;;       (let ((subject (mixi-diary-title diary))
-;;             (from (mixi-friend-nick (mixi-diary-owner diary)))
-;;             (date (format-time-string format (mixi-diary-time diary)))
-;;             (body (mixi-remove-markup (mixi-diary-content diary))))
-;;         (insert "From: " from "\n"
-;;                 "Subject: " subject "\n"
-;;                 "Date: " date "\n\n"
-;;                 body "\n\n")
-;;         (mapc (lambda (comment)
-;;                 (let ((from (mixi-friend-nick
-;;                              (mixi-comment-owner comment)))
-;;                       (subject (concat "Re: " subject))
-;;                       (date (format-time-string
-;;                              format (mixi-comment-time comment)))
-;;                       (body (mixi-remove-markup
-;;                              (mixi-comment-content comment))))
-;;                   (insert "From: " from "\n"
-;;                           "Subject: " subject "\n"
-;;                           "Date: " date "\n\n"
-;;                           body "\n\n")))
-;;               (mixi-get-comments diary range))))
-;;     (mixi-get-new-diaries range))
+;;   (let ((diaries (mixi-get-new-diaries range)))
+;;     (while diaries
+;;       (let* ((diary (car diaries))
+;;          (subject (mixi-diary-title diary))
+;;          (from (mixi-friend-nick (mixi-diary-owner diary)))
+;;          (date (format-time-string format (mixi-diary-time diary)))
+;;          (body (mixi-remove-markup (mixi-diary-content diary))))
+;;     (insert "From: " from "\n"
+;;             "Subject: " subject "\n"
+;;             "Date: " date "\n\n"
+;;             body "\n\n")
+;;     (let ((comments (mixi-get-comments diary range)))
+;;       (while comments
+;;         (let* ((comment (car comments))
+;;                (from (mixi-friend-nick (mixi-comment-owner comment)))
+;;                (subject (concat "Re: " subject))
+;;                (date (format-time-string format
+;;                                          (mixi-comment-time comment)))
+;;                (body (mixi-remove-markup (mixi-comment-content comment))))
+;;           (insert "From: " from "\n"
+;;                   "Subject: " subject "\n"
+;;                   "Date: " date "\n\n"
+;;                   body "\n\n"))
+;;         (setq comments (cdr comments)))))
+;;       (setq diaries (cdr diaries))))
 ;;   (set-buffer-modified-p nil)
 ;;   (setq buffer-read-only t)
 ;;   (goto-char (point-min)))
 ;; at run-time.
 (eval-when-compile
   (defvar w3m-use-cookies)
-  (defvar url-request-method)
-  (defvar url-request-data)
-  (defvar url-request-extra-headers)
-  (defvar url-show-status)
   (autoload 'w3m-decode-buffer "w3m")
   (autoload 'w3m-retrieve "w3m")
   (autoload 'url-retrieve-synchronously "url"))
 
+(defconst mixi-revision "$Revision: 1.209 $")
+
 (defgroup mixi nil
   "API library for accessing to mixi."
   :group 'hypermedia)
@@ -212,6 +222,11 @@ Increase this value when unexpected error frequently occurs."
   :type 'number
   :group 'mixi)
 
+(defcustom mixi-replace-tab-and-space-to-nbsp t
+  "*If non-nil, replace tab and space to &nbsp; for keeping formatted."
+  :type 'boolean
+  :group 'mixi)
+
 (defcustom mixi-cache-expires nil
   "*Seconds for expiration of a cached object."
   :type '(radio (integer :tag "Expired seconds")
@@ -263,9 +278,7 @@ Increase this value when unexpected error frequently occurs."
 ¿·¤ÏÀ©¸Â¤µ¤»¤Æ¤¤¤¿¤À¤¤¤Æ¤ª¤ê¤Þ¤¹¡£¤´ÌÂÏǤò¤ª¤«¤±¤¤¤¿¤·¤Þ¤¹¤¬¡¢¤·¤Ð¤é¤¯¤ª<br>
 ÂÔ¤Á¤¤¤¿¤À¤¤¤Æ¤«¤éÁàºî¤ò¤ª¤³¤Ê¤Ã¤Æ¤¯¤À¤µ¤¤¡£")
 (defconst mixi-warning-continuously-accessing
-  "´Ö³Ö¤ò¶õ¤±¤Ê¤¤Ï¢Â³Åª¤Ê¥Ú¡¼¥¸¤ÎÁ«°Ü¡¦¹¹¿·¤òÉÑÈˤˤª¤³¤Ê¤ï¤ì¤Æ¤¤¤ë¤³¤È¤¬¸«<br>
-¼õ¤±¤é¤ì¤Þ¤·¤¿¤Î¤Ç¡¢°ì»þŪ¤ËÁàºî¤òÄä»ß¤µ¤»¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£¿½¤·Ìõ¤´¤¶¤¤¤Þ<br>
-¤»¤ó¤¬¡¢¤·¤Ð¤é¤¯¤Î´Ö¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£")
+  "´Ö³Ö¤ò¶õ¤±¤Ê¤¤Ï¢Â³Åª¤Ê¥Ú¡¼¥¸¤ÎÁ«°Ü¡¦¹¹¿·¤òÉÑÈˤˤª¤³¤Ê¤ï¤ì¤Æ¤¤¤ë¤³¤È¤¬¸«¼õ¤±¤é¤ì¤Þ¤·¤¿¤Î¤Ç¡¢°ì»þŪ¤ËÁàºî¤òÄä»ß¤µ¤»¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¤·¤Ð¤é¤¯¤Î´Ö¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£")
 
 (defmacro mixi-retrieve (url &optional post-data)
   `(funcall (intern (concat "mixi-" (symbol-name mixi-backend) "-retrieve"))
@@ -320,13 +333,13 @@ Increase this value when unexpected error frequently occurs."
         (buffer (url-retrieve-synchronously url))
         ret)
     (unless (bufferp buffer)
-      (error (mixi-message "Cannot retrieve")))
+      (error (mixi-message "Cannot retrieve: " url)))
     (with-current-buffer buffer
       (goto-char (point-min))
       (while (looking-at "HTTP/[0-9]+\\.[0-9]+ [13][0-9][0-9]")
        (delete-region (point) (re-search-forward "\r?\n\r?\n")))
       (unless (looking-at "HTTP/[0-9]+\\.[0-9]+ 200")
-       (error (mixi-message "Cannot retrieve")))
+       (error (mixi-message "Cannot retrieve: " url)))
       (delete-region (point) (re-search-forward "\r?\n\r?\n"))
       (setq ret (decode-coding-string (buffer-string) mixi-coding-system))
       (kill-buffer buffer)
@@ -342,7 +355,7 @@ Increase this value when unexpected error frequently occurs."
   (let ((url (mixi-expand-url url)))
     (with-temp-buffer
       (if (not (string= (w3m-retrieve url nil nil post-data) "text/html"))
-         (error (mixi-message "Cannot retrieve"))
+         (error (mixi-message "Cannot retrieve: " url))
        (w3m-decode-buffer url)
        (let ((ret (buffer-substring-no-properties (point-min) (point-max))))
          (mixi-parse-buffer url ret post-data))))))
@@ -383,7 +396,7 @@ Increase this value when unexpected error frequently occurs."
       (while (looking-at "HTTP/[0-9]+\\.[0-9]+ [13][0-9][0-9]")
        (delete-region (point) (re-search-forward "\r?\n\r?\n")))
       (unless (looking-at "HTTP/[0-9]+\\.[0-9]+ 200")
-       (error (mixi-message "Cannot retrieve")))
+       (error (mixi-message "Cannot retrieve: " url)))
       (delete-region (point) (re-search-forward "\r?\n\r?\n"))
       (setq ret (decode-coding-string (buffer-string) mixi-coding-system))
       (mixi-parse-buffer url ret post-data))))
@@ -400,7 +413,7 @@ Increase this value when unexpected error frequently occurs."
     (mixi-curl-retrieve url nil (reverse form-data))))
 
 (defconst mixi-my-id-regexp
-  "<a href=\"add_diary\\.pl\\?id=\\([0-9]+\\)")
+  "<a href=\"http://mixi.jp/show_profile\\.pl\\?id=\\([0-9]+\\)")
 
 (defun mixi-login (&optional email password)
   "Login to mixi."
@@ -411,9 +424,9 @@ Increase this value when unexpected error frequently occurs."
                   (read-from-minibuffer (mixi-message "Login Email: "))))
        (password (or password mixi-default-password
                      (read-passwd (mixi-message "Login Password: ")))))
-    (let ((url "/login.pl"))
-      (when mixi-login-use-ssl
-       (setq url (concat "https://mixi.jp" url)))
+    (let ((url (mixi-expand-url "/login.pl")))
+      (when (and mixi-login-use-ssl (string-match "^http:" url))
+       (setq url (replace-match "https:" nil nil url)))
       (let ((buffer (mixi-retrieve url
                                   (concat "email=" email
                                           "&password=" password
@@ -429,14 +442,15 @@ Increase this value when unexpected error frequently occurs."
 (defun mixi-logout ()
   (mixi-retrieve "/logout.pl"))
 
+(defconst mixi-login-form "<form action=\"/login.pl\" method=\"post\" name=\"login_form\">")
+
 (defmacro with-mixi-retrieve (url &rest body)
   `(with-current-buffer (get-buffer-create mixi-temp-buffer-name)
      (when ,url
        (erase-buffer)
        (insert (mixi-retrieve ,url))
        (goto-char (point-min))
-       (when (search-forward
-             "<form action=\"login.pl\" method=\"post\">" nil t)
+       (when (search-forward mixi-login-form nil t)
         (mixi-login)
         (erase-buffer)
         (insert (mixi-retrieve ,url))))
@@ -451,8 +465,7 @@ Increase this value when unexpected error frequently occurs."
        (erase-buffer)
        (insert (mixi-post-form ,url ,fields))
        (goto-char (point-min))
-       (when (search-forward
-             "<form action=\"login.pl\" method=\"post\">" nil t)
+       (when (search-forward mixi-login-form nil t)
         (mixi-login)
         (erase-buffer)
         (insert (mixi-post-form ,url ,fields))))
@@ -466,7 +479,8 @@ Increase this value when unexpected error frequently occurs."
   (let ((page 1)
        ids)
     (catch 'end
-      (while (or (null range) (< (length ids) range))
+      (while (and (or (null range) (< (length ids) range))
+                 (or (= page 1) (and (stringp url) (string-match "%d" url))))
        (with-mixi-retrieve (when url (format url page))
          (let ((func (if reverse (progn
                                    (goto-char (point-max))
@@ -509,6 +523,29 @@ Increase this value when unexpected error frequently occurs."
     (buffer-string)))
 
 ;; stolen (and modified) from w3m.el
+(defconst mixi-entity-alist '(("gt" . ">")
+                             ("lt" . "<")
+                             ("amp" . "&"))
+  "Alist of html character entities and values.")
+
+;; stolen (and modified) from w3m.el
+(defun mixi-encode-specials-string (str)
+  "Encode special characters in the string STR."
+  (let ((pos 0)
+       (buf))
+    (while (string-match "[<>&]" str pos)
+      (setq buf
+           (cons ";"
+                 (cons (car (rassoc (match-string 0 str) mixi-entity-alist))
+                       (cons "&"
+                             (cons (substring str pos (match-beginning 0))
+                                   buf))))
+           pos (match-end 0)))
+    (if buf
+       (apply 'concat (nreverse (cons (substring str pos) buf)))
+      str)))
+
+;; stolen (and modified) from w3m.el
 (defun mixi-url-encode-string (string)
   (apply (function concat)
         (mapcar
@@ -534,6 +571,18 @@ Increase this value when unexpected error frequently occurs."
       (setq pos (+ (match-end 0) 1)))
     string))
 
+(defun mixi-replace-tab-and-space-to-nbsp (string)
+  (when mixi-replace-tab-and-space-to-nbsp
+    (let ((pos 0))
+      (while (or (string-match "\t" string pos)
+                (string-match " " string pos))
+       (if (string= (match-string 0 string) "\t")
+           (setq string (replace-match (make-string tab-width ?\ )
+                                       nil nil string))
+         (setq string (replace-match "&nbsp;" nil nil string))
+         (setq pos (+ (match-end 0) 1))))
+      string)))
+
 ;; Object.
 (defconst mixi-object-prefix "mixi-")
 
@@ -694,24 +743,24 @@ Increase this value when unexpected error frequently occurs."
     (unless (file-directory-p cache-directory)
       (make-directory cache-directory t))
     (let ((caches (apropos-internal mixi-cache-regexp 'boundp)))
-      (mapc (lambda (symbol)
-             (with-temp-file (expand-file-name
-                              (substring (symbol-name symbol)
-                                         (length mixi-object-prefix))
-                              cache-directory)
-               (let ((coding-system-for-write mixi-coding-system)
-                     (cache (symbol-value symbol)))
-                 (insert "#s(hash-table size "
-                         (number-to-string (hash-table-count cache))
-                         " test equal data (\n")
-                 (maphash
-                  (lambda (key value)
-                    (let (print-level print-length)
-                      (insert (prin1-to-string key) " "
-                              (prin1-to-string value) "\n")))
-                  cache))
-               (insert "))")))
-           caches))))
+      (while caches
+       (with-temp-file (expand-file-name
+                        (substring (symbol-name (car caches))
+                                   (length mixi-object-prefix))
+                        cache-directory)
+         (let ((coding-system-for-write mixi-coding-system)
+               (cache (symbol-value (car caches))))
+           (insert "#s(hash-table size "
+                   (number-to-string (hash-table-count cache))
+                   " test equal data (\n")
+           (maphash
+            (lambda (key value)
+              (let (print-level print-length)
+                (insert (prin1-to-string key) " "
+                        (prin1-to-string value) "\n")))
+            cache))
+         (insert "))"))
+       (setq caches (cdr caches))))))
 
 ;; stolen (and modified) from lsdb.el
 (defun mixi-read-cache (&optional marker)
@@ -747,17 +796,17 @@ Increase this value when unexpected error frequently occurs."
       ;; FIXME: Load friend and community first.
       (let ((files (directory-files cache-directory t
                                    mixi-cache-file-regexp)))
-       (mapc (lambda (file)
-               (let ((buffer (find-file-noselect file)))
-                 (unwind-protect
-                     (save-excursion
-                       (set-buffer buffer)
-                       (goto-char (point-min))
-                       (re-search-forward "^#s(")
-                       (goto-char (match-beginning 0))
-                       (mixi-read-cache (point-marker)))
-                   (kill-buffer buffer))))
-             files)))))
+       (while files
+         (let ((buffer (find-file-noselect (car files))))
+           (unwind-protect
+               (save-excursion
+                 (set-buffer buffer)
+                 (goto-char (point-min))
+                 (re-search-forward "^#s(")
+                 (goto-char (match-beginning 0))
+                 (mixi-read-cache (point-marker)))
+             (kill-buffer buffer)))
+         (setq files (cdr files)))))))
 
 ;; Friend object.
 (defvar mixi-friend-cache (make-hash-table :test 'equal))
@@ -775,7 +824,7 @@ Increase this value when unexpected error frequently occurs."
   "Return a my object."
   (unless mixi-me
     (with-mixi-retrieve "/home.pl"
-      (if (re-search-forward mixi-my-id-regexp)
+      (if (re-search-forward mixi-my-id-regexp nil t)
          (setq mixi-me (mixi-make-friend (match-string 1)))
        (signal 'error (list 'who-am-i)))))
   mixi-me)
@@ -795,58 +844,51 @@ Increase this value when unexpected error frequently occurs."
   `(eq (mixi-object-class ,friend) 'mixi-friend))
 
 (defmacro mixi-friend-page (friend)
-  `(concat "/show_profile.pl?id=" (mixi-friend-id ,friend)))
+  `(concat "/show_friend.pl?id=" (mixi-friend-id ,friend)))
 
 (defconst mixi-friend-nick-regexp
-  "<img \\(alt=\"\\*\" \\)?src=\"?http://img\\.mixi\\.jp/img/dot0\\.gif\"? width=\"?1\"? height=\"?5\"?\\( /\\)?><br\\( /\\)?>\r?
-\\(.*\\)¤µ¤ó([0-9]+)")
+  "<p class=\"name\">\\(.*\\)¤µ¤ó([0-9]+)\n")
 (defconst mixi-friend-name-regexp
-  "̾\\(&nbsp;\\| \\)Á°</font></td>
-
-?<td width=\"?345\"?>\\(.+?\\)\\(</td>\\| <img\\)")
+  "<th>̾Á°</th>\n+?<td>\\(.+?\\)\\(<img\\|</td>\\)")
 (defconst mixi-friend-sex-regexp
-  "À­\\(&nbsp;\\| \\)ÊÌ</font></td>
-
-?<td width=\"?345\"?>\\([Ã˽÷]\\)À­\\(</td>\\| <img\\)")
+  "<th>À­ÊÌ</th>\n+?<td>\\([Ã˽÷]\\)À­\\(<img\\|</td>\\)")
 (defconst mixi-friend-address-regexp
-  "¸½½»½ê</font></td>
-<td>\\(.+?\\)\\(</td>\\| <img\\)")
+  "<th>¸½½»½ê</th>\n+?<td>\\(.+?\\)\\(<img \\|</td>\\)")
 (defconst mixi-friend-age-regexp
-  "ǯ\\(&nbsp;\\| \\)Îð</font></td>\n<td>\\([0-9]+\\)ºÐ\\(</td>\\| <img\\)")
+  "<th>ǯÎð</th>\n+?<td>\\([0-9]+\\)ºÐ\\( <img\\|</td>\\)")
 (defconst mixi-friend-birthday-regexp
-  "ÃÂÀ¸Æü</font></td>\n<td>\\([0-9]+\\)·î\\([0-9]+\\)Æü\\(</td>\\| <img\\)")
+  "<th>ÃÂÀ¸Æü</th>\n+?<td>\\([0-9]+\\)·î\\([0-9]+\\)Æü\\(<img \\|</td>\\)")
 (defconst mixi-friend-blood-type-regexp
-  "·ì±Õ·¿</font></td>\n<td>\\([ABO]B?\\)·¿\\(</td>\\| <img\\)")
+  "<th>·ì±Õ·¿</th>\n+?<td>\\([ABO]B?\\)·¿\\(<img \\|</td>\\)")
 (defconst mixi-friend-birthplace-regexp
-  "½Ð¿ÈÃÏ</font>\n?</td>\n<td>\\(.+?\\)\\(</td>\\| <img\\)")
+  "<th>½Ð¿ÈÃÏ</th>\n+?<td>\\(.+?\\)\\(<img \\|</td>\\)")
 (defconst mixi-friend-hobby-regexp
-  "¼ñ\\(&nbsp;\\| \\)Ì£</font></td>\n<td>\\(.+?\\)\\(</td>\\| <img\\)")
+  "<th>¼ñÌ£</th>\n+?<td>\\(.+?\\)\\(<img \\|</td>\\)")
 (defconst mixi-friend-job-regexp
-  "¿¦\\(&nbsp;\\| \\)¶È</font></td>\n<td>\\(.+?\\)\\(</td>\\| <img\\)")
+  "<th>¿¦¶È</th>\n+?<td>\\(.+?\\)\\(<img \\|</td>\\)")
 (defconst mixi-friend-organization-regexp
-  "½ê\\(&nbsp;\\| \\)°</font></td>\n<td[^>]*>\\(.+?\\)\\(</td>\\| <img\\)")
+  "<th>½ê°</th>\n+?<td>\\(.+?\\)\\(<img \\|</td>\\)")
 (defconst mixi-friend-profile-regexp
-  "¼«¸Ê¾Ò²ð</font></td>
-<td class=\"?h120\"?>\\(.+\\)</td></tr>")
+  "<th>¼«¸Ê¾Ò²ð</th>\n+?<td>\\(.+?\\)</td>")
 
 (defun mixi-realize-friend (friend)
   "Realize a FRIEND."
-  ;; FIXME: Check a expiration of cache?
+  ;; FIXME: Check an expiration of cache?
   (unless (mixi-object-realized-p friend)
     (with-mixi-retrieve (mixi-friend-page friend)
       (let ((case-fold-search t))
        (if (re-search-forward mixi-friend-nick-regexp nil t)
-           (mixi-friend-set-nick friend (match-string 4))
+           (mixi-friend-set-nick friend (match-string 1))
          (mixi-realization-error 'cannot-find-nick friend))
        (when (re-search-forward mixi-friend-name-regexp nil t)
-         (mixi-friend-set-name friend (match-string 2)))
+         (mixi-friend-set-name friend (match-string 1)))
        (when (re-search-forward mixi-friend-sex-regexp nil t)
-         (mixi-friend-set-sex friend (if (string= (match-string 2) "ÃË")
+         (mixi-friend-set-sex friend (if (string= (match-string 1) "ÃË")
                                          'male 'female)))
        (when (re-search-forward mixi-friend-address-regexp nil t)
          (mixi-friend-set-address friend (match-string 1)))
        (when (re-search-forward mixi-friend-age-regexp nil t)
-         (mixi-friend-set-age friend (string-to-number (match-string 2))))
+         (mixi-friend-set-age friend (string-to-number (match-string 1))))
        (when (re-search-forward mixi-friend-birthday-regexp nil t)
          (mixi-friend-set-birthday
           friend (list (string-to-number (match-string 1))
@@ -856,11 +898,11 @@ Increase this value when unexpected error frequently occurs."
        (when (re-search-forward mixi-friend-birthplace-regexp nil t)
          (mixi-friend-set-birthplace friend (match-string 1)))
        (when (re-search-forward mixi-friend-hobby-regexp nil t)
-         (mixi-friend-set-hobby friend (split-string (match-string 2) ", ")))
+         (mixi-friend-set-hobby friend (split-string (match-string 1) ", ")))
        (when (re-search-forward mixi-friend-job-regexp nil t)
-         (mixi-friend-set-job friend (match-string 2)))
+         (mixi-friend-set-job friend (match-string 1)))
        (when (re-search-forward mixi-friend-organization-regexp nil t)
-         (mixi-friend-set-organization friend (match-string 2)))
+         (mixi-friend-set-organization friend (match-string 1)))
        (when (re-search-forward mixi-friend-profile-regexp nil t)
          (mixi-friend-set-profile friend (match-string 1)))))
     (mixi-object-touch friend)))
@@ -950,7 +992,7 @@ Increase this value when unexpected error frequently occurs."
   (aref (cdr friend) 12))
 
 (defun mixi-friend-profile (friend)
-  "Return the pforile of FRIEND."
+  "Return the profile of FRIEND."
   (unless (mixi-friend-p friend)
     (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
   (mixi-realize-friend friend)
@@ -1028,14 +1070,18 @@ Increase this value when unexpected error frequently occurs."
     (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
   (aset (cdr friend) 13 profile))
 
-(defmacro mixi-friend-list-page (&optional friend)
-  `(concat "/list_friend.pl?page=%d"
-          (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
+(defun mixi-my-friend-list-page (&optional dummy)
+  (concat "/list_friend_simple.pl?page=%d"))
+
+(defun mixi-friend-list-page (friend)
+  (concat "/list_friend.pl?page=%d&id=" (mixi-friend-id friend)))
 
 (defconst mixi-friend-list-id-regexp
-  "<a href=show_friend\\.pl\\?id=\\([0-9]+\\)")
+  "<a href=\"?show_friend\\.pl\\?id=\\([0-9]+\\)\"?")
+(defconst mixi-my-friend-list-nick-regexp
+  "<p>\\(.+\\)([0-9]+)</p>")
 (defconst mixi-friend-list-nick-regexp
-  "<td valign=middle>\\(.+\\)¤µ¤ó([0-9]+)<br />")
+  "<span>\\(.+\\)¤µ¤ó([0-9]+)</span>")
 
 ;;;###autoload
 (defun mixi-get-friends (&rest friend-or-range)
@@ -1050,19 +1096,25 @@ Increase this value when unexpected error frequently occurs."
       (setq range (nth 0 friend-or-range)))
     (unless (or (null friend) (mixi-friend-p friend))
       (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
-    (let ((ids (mixi-get-matched-items (mixi-friend-list-page friend)
-                                      mixi-friend-list-id-regexp
-                                      range))
-         (nicks (mixi-get-matched-items (mixi-friend-list-page friend)
-                                        mixi-friend-list-nick-regexp
-                                        range)))
-      (let ((index 0)
-           ret)
-       (while (< index (length ids))
-         (setq ret (cons (mixi-make-friend (nth 0 (nth index ids))
-                                           (nth 0 (nth index nicks))) ret))
-         (incf index))
-       (reverse ret)))))
+    (let (list-page list-nick-regexp)
+      (if (or (null friend) (equal friend mixi-me))
+         (setq list-page 'mixi-my-friend-list-page
+               list-nick-regexp mixi-my-friend-list-nick-regexp)
+       (setq list-page 'mixi-friend-list-page
+             list-nick-regexp mixi-friend-list-nick-regexp))
+      (let ((ids (mixi-get-matched-items (funcall list-page friend)
+                                        mixi-friend-list-id-regexp
+                                        range))
+           (nicks (mixi-get-matched-items (funcall list-page friend)
+                                          list-nick-regexp
+                                          range)))
+       (let ((index 0)
+             ret)
+         (while (< index (length ids))
+           (setq ret (cons (mixi-make-friend (nth 0 (nth index ids))
+                                             (nth 0 (nth index nicks))) ret))
+           (incf index))
+         (reverse ret))))))
 
 ;; Favorite.
 (defmacro mixi-favorite-list-page ()
@@ -1102,26 +1154,57 @@ Increase this value when unexpected error frequently occurs."
     (signal 'wrong-type-argument (list 'mixi-log-p log)))
   (aref (cdr log) 1))
 
-(defmacro mixi-log-list-page ()
-  `(concat "/show_log.pl"))
+(defconst mixi-log-list-page "/show_log.pl")
 
 (defconst mixi-log-list-regexp
-  "\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\) <a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*?\\)</a>")
+  "\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</span><span class=\"name\"><a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*?\\)</a>")
+
+(defun mixi-get-logs-internal (list-page &optional range)
+  (let ((items (mixi-get-matched-items list-page
+                                      mixi-log-list-regexp
+                                      range))
+       (year (nth 5 (decode-time (current-time))))
+       (month (nth 4 (decode-time (current-time)))))
+    (mapcar (lambda (item)
+             (let ((month-of-item (string-to-number (nth 0 item))))
+               (when (> month-of-item month)
+                 (decf year))
+               (setq month month-of-item)
+               (mixi-make-log (mixi-make-friend (nth 4 item) (nth 5 item))
+                              (encode-time 0
+                                           (string-to-number (nth 3 item))
+                                           (string-to-number (nth 2 item))
+                                           (string-to-number (nth 1 item))
+                                           month year))))
+           items)))
 
 ;;;###autoload
 (defun mixi-get-logs (&optional range)
   "Get logs."
-  (let ((items (mixi-get-matched-items (mixi-log-list-page)
-                                      mixi-log-list-regexp
+  (mixi-get-logs-internal mixi-log-list-page range))
+
+(defconst mixi-log-self-list-page "/show_self_log.pl")
+
+;;;###autoload
+(defun mixi-get-self-logs (&optional range)
+  "Get self logs."
+  (mixi-get-logs-internal mixi-log-self-list-page range))
+
+;; Recommended friend.
+(defmacro mixi-recommended-friend-list-page ()
+  `(concat "http://indies.mixi.jp/recommend.pl"))
+
+(defconst mixi-recommended-friend-list-regexp
+  "<div class=\"iconListImage\"><a href=\"http://mixi\\.jp/show_friend\\.pl\\?id=\\([0-9]+\\)\" [^>]+>.+</a></div><span>\\(.+?\\)¤µ¤ó([0-9]+)</span>")
+
+;;;###autoload
+(defun mixi-get-recommended-friends (&optional range)
+  "Get recommended friends."
+  (let ((items (mixi-get-matched-items (mixi-recommended-friend-list-page)
+                                      mixi-recommended-friend-list-regexp
                                       range)))
     (mapcar (lambda (item)
-             (mixi-make-log (mixi-make-friend (nth 5 item) (nth 6 item))
-                            (encode-time 0
-                                         (string-to-number (nth 4 item))
-                                         (string-to-number (nth 3 item))
-                                         (string-to-number (nth 2 item))
-                                         (string-to-number (nth 1 item))
-                                         (string-to-number (nth 0 item)))))
+             (mixi-make-friend (nth 0 item) (nth 1 item)))
            items)))
 
 ;; Diary object.
@@ -1153,39 +1236,46 @@ Increase this value when unexpected error frequently occurs."
           "&owner_id=" (mixi-friend-id (mixi-diary-owner ,diary))))
 
 (defconst mixi-diary-closed-regexp
-  "<td>ͧ¿Í\\(¤Îͧ¿Í\\)?¤Þ¤Ç¸ø³«¤Î¤¿¤áÆɤळ¤È¤¬½ÐÍè¤Þ¤»¤ó¡£</td></tr>")
+  "¤³¤ÎÆüµ­¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤»¤ó¡£°Ê²¼¤Î²ÄǽÀ­¤¬¹Í¤¨¤é¤ì¤Þ¤¹¡£<br />")
 (defconst mixi-diary-owner-nick-regexp
-  "<td WIDTH=490 background=http://img\\.mixi\\.jp/img/bg_w\\.gif><b><font COLOR=#605048>\\(.+?\\)\\(¤µ¤ó\\)?¤ÎÆüµ­</font></b></td>")
-(defconst mixi-diary-time-regexp
-  "<td \\(align\\|ALIGN\\)=\"?center\"? \\(rowspan\\|ROWSPAN\\)=\"?[23]\"? \\(nowrap=\"nowrap\"\\|NOWRAP\\) \\(width\\|WIDTH\\)=\"?95\"? bgcolor=\"?#FFD8B0\"?>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü\\(<br />\\|<br>\\)\\([0-9]+\\):\\([0-9]+\\)</td>")
+  "<div class=\"diaryTitle\\(Friend\\)? clearfix\">
+<h2>\\(.+?\\)\\(¤µ¤ó\\)?¤ÎÆüµ­</h2>")
 (defconst mixi-diary-title-regexp
-  "<td \\(bgcolor\\|BGCOLOR\\)=\"?#FFF4E0\"? width=\"?430\"?>&nbsp;\\([^<]+\\)</td>")
+  "<div class=\"listDiaryTitle\">
+<dl>
+<dt>\\([^<\n]+\\)\\(<span>\\)?")
+(defconst mixi-diary-time-regexp
+  "<dd>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü\\([0-9]+\\):\\([0-9]+\\)</dd>")
 (defconst mixi-diary-content-regexp
-  "<td \\(class\\|CLASS\\)=\"?h12\"?>\\(.*\\)</td>")
+  "<div class=\"txtconfirmArea\">
+\\(\\(.\\|\r?\n\\)*?\\)
+<!--/viewDiaryBox--></div>")
 
 (defun mixi-realize-diary (diary &optional page)
   "Realize a DIARY."
-  ;; FIXME: Check a expiration of cache?
+  ;; FIXME: Check an expiration of cache?
   (unless (mixi-object-realized-p diary)
     (with-mixi-retrieve (or page (mixi-diary-page diary))
-      (unless (re-search-forward mixi-diary-closed-regexp nil t)
-       (if (re-search-forward mixi-diary-owner-nick-regexp nil t)
-           (mixi-friend-set-nick (mixi-diary-owner diary) (match-string 1))
-         (mixi-realization-error 'cannot-find-owner-nick diary))
-       (if (re-search-forward mixi-diary-time-regexp nil t)
-           (mixi-diary-set-time
-            diary (encode-time 0 (string-to-number (match-string 10))
-                               (string-to-number (match-string 9))
-                               (string-to-number (match-string 7))
-                               (string-to-number (match-string 6))
-                               (string-to-number (match-string 5))))
-         (mixi-realization-error 'cannot-find-time diary))
-       (if (re-search-forward mixi-diary-title-regexp nil t)
-           (mixi-diary-set-title diary (match-string 2))
-         (mixi-realization-error 'cannot-find-title diary))
-       (if (re-search-forward mixi-diary-content-regexp nil t)
-           (mixi-diary-set-content diary (match-string 2))
-         (mixi-realization-error 'cannot-find-content diary))))
+      (let ((case-fold-search t))
+       (unless (re-search-forward mixi-diary-closed-regexp nil t)
+         (if (re-search-forward mixi-diary-owner-nick-regexp nil t)
+             (mixi-friend-set-nick (mixi-diary-owner diary)
+                                   (match-string 2))
+           (mixi-realization-error 'cannot-find-owner-nick diary))
+         (if (re-search-forward mixi-diary-title-regexp nil t)
+             (mixi-diary-set-title diary (match-string 1))
+           (mixi-realization-error 'cannot-find-title diary))
+         (if (re-search-forward mixi-diary-time-regexp nil t)
+             (mixi-diary-set-time
+              diary (encode-time 0 (string-to-number (match-string 5))
+                                 (string-to-number (match-string 4))
+                                 (string-to-number (match-string 3))
+                                 (string-to-number (match-string 2))
+                                 (string-to-number (match-string 1))))
+           (mixi-realization-error 'cannot-find-time diary))
+         (if (re-search-forward mixi-diary-content-regexp nil t)
+             (mixi-diary-set-content diary (match-string 1))
+           (mixi-realization-error 'cannot-find-content diary)))))
     (mixi-object-touch diary)))
 
 (defun mixi-diary-owner (diary)
@@ -1258,9 +1348,9 @@ Increase this value when unexpected error frequently occurs."
           (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
 
 (defconst mixi-diary-list-regexp
-  "<tr VALIGN=top>
-<td ALIGN=center ROWSPAN=3 NOWRAP bgcolor=#F2DDB7><font COLOR=#996600>\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>\\([0-9]+\\):\\([0-9]+\\)</font>\\(<br><input type=\"checkbox\" name=\"diary_id\" value=\"[0-9]+\">\\|\\)</td>
-<td bgcolor=\"#FFF4E0\">&nbsp;<a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=[0-9]+\">\\(.*\\)</a></td>")
+  "<dt>\\(<input name=\"diary_id\" type=\"checkbox\" value=\"[0-9]+\"  />\\|\\)<a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=[0-9]+\">\\(.*\\)</a>\\(<span><a href=\"edit_diary\\.pl\\?id=[0-9]+\">ÊÔ½¸¤¹¤ë</a></span>\\|\\)</dt>
+<dd>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü\n?\\([0-9]+\\):\\([0-9]+\\)</dd>
+</dl>")
 
 ;;;###autoload
 (defun mixi-get-diaries (&rest friend-or-range)
@@ -1277,29 +1367,26 @@ Increase this value when unexpected error frequently occurs."
       (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
     (let ((items (mixi-get-matched-items (mixi-diary-list-page friend)
                                         mixi-diary-list-regexp
-                                        range))
-         (year (nth 5 (decode-time (current-time))))
-         (month (nth 4 (decode-time (current-time)))))
+                                        range)))
       (mapcar (lambda (item)
-               (let ((month-of-item (string-to-number (nth 0 item))))
-                 (when (> month-of-item month)
-                   (decf year))
-                 (setq month month-of-item)
-                 (mixi-make-diary friend (nth 5 item) nil
-                                  (encode-time
-                                   0 (string-to-number (nth 3 item))
-                                   (string-to-number (nth 2 item))
-                                   (string-to-number (nth 1 item))
-                                   month year)
-                                  (nth 6 item))))
+               (mixi-make-diary friend (nth 1 item) nil
+                                (encode-time
+                                 0 (string-to-number (nth 8 item))
+                                 (string-to-number (nth 7 item))
+                                 (string-to-number (nth 6 item))
+                                 (string-to-number (nth 5 item))
+                                 (string-to-number (nth 4 item)))
+                                 (nth 2 item)))
              items))))
 
 (defmacro mixi-new-diary-list-page ()
   `(concat "/new_friend_diary.pl?page=%d"))
 
 (defconst mixi-new-diary-list-regexp
-  "<td WIDTH=180><img src=http://img\\.mixi\\.jp/img/pen\\.gif ALIGN=left WIDTH=14 HEIGHT=16>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</td>
-<td WIDTH=450><a class=\"new_link\" href=view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)>\\(.+\\)</a> (\\(.*\\)) ")
+  "<dt>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü&nbsp;\\([0-9]+\\):\\([0-9]+\\)</dt>
+<dd><a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)\">\\(.+\\)</a> (\\(.*\\))<div ")
+(defconst mixi-new-diary-list-title-regexp
+  "\\(.+\\) (\\([0-9]+\\))")
 
 ;;;###autoload
 (defun mixi-get-new-diaries (&optional range)
@@ -1307,44 +1394,46 @@ Increase this value when unexpected error frequently occurs."
   (let ((items (mixi-get-matched-items (mixi-new-diary-list-page)
                                       mixi-new-diary-list-regexp
                                       range)))
-    (mapcar (lambda (item)
-             (mixi-make-diary (mixi-make-friend (nth 6 item) (nth 8 item))
-                              (nth 5 item)
-                              nil
-                              (encode-time
-                               0 (string-to-number (nth 4 item))
-                               (string-to-number (nth 3 item))
-                               (string-to-number (nth 2 item))
-                               (string-to-number (nth 1 item))
-                               (string-to-number (nth 0 item)))
-                              (nth 7 item)))
-           items)))
+    (delq nil
+         (mapcar (lambda (item)
+                   (let ((title (nth 7 item))
+                         count)
+                     (when (string-match mixi-new-diary-list-title-regexp
+                                         title)
+                       (setq count (string-to-number (match-string 2 title)))
+                       (setq title (match-string 1 title)))
+                     (let* ((diary (mixi-make-diary
+                                    (mixi-make-friend (nth 6 item)
+                                                      (nth 8 item))
+                                    (nth 5 item)))
+                            (comment-count (mixi-diary-comment-count diary)))
+                       (mixi-diary-set-time diary
+                                            (encode-time
+                                             0 (string-to-number (nth 4 item))
+                                             (string-to-number (nth 3 item))
+                                             (string-to-number (nth 2 item))
+                                             (string-to-number (nth 1 item))
+                                             (string-to-number (nth 0 item))))
+                       (mixi-diary-set-title diary title)
+                       (when (or (null comment-count)
+                                 (< comment-count count))
+                         (mixi-diary-set-comment-count diary count)
+                         diary))))
+                 items))))
 
 (defmacro mixi-search-diary-list-page (keyword)
   `(concat "/search_diary.pl?page=%d&submit=search&keyword="
             (mixi-url-encode-and-quote-percent-string ,keyword)))
 
 (defconst mixi-search-diary-list-regexp
-  "<td BGCOLOR=#FDF9F2><font COLOR=#996600>̾&nbsp;&nbsp;Á°</font></td>
-<td COLSPAN=2 BGCOLOR=#FFFFFF>\\(.*\\)
-
-</td></tr>
-
-<tr>
-<td BGCOLOR=#FDF9F2><font COLOR=#996600>¥¿¥¤¥È¥ë</font></td>
-<td COLSPAN=2 BGCOLOR=#FFFFFF>\\(.+\\)</td></tr>
-
-<tr>
-<td BGCOLOR=#FDF9F2><font COLOR=#996600>ËÜ&nbsp;&nbsp;ʸ</font></td>
-<td COLSPAN=2 BGCOLOR=#FFFFFF>\\(.*\\)</td></tr>
-
-
-<tr>
-<td NOWRAP BGCOLOR=#FDF9F2 WIDTH=80><font COLOR=#996600>ºîÀ®Æü»þ</font></td>
-<td BGCOLOR=#FFFFFF WIDTH=220>\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</td>
-<td ALIGN=center BGCOLOR=#FDF9F2 width=250><a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)\"><img src=http://img\\.mixi\\.jp/img/shbtn\\.gif ALT=¾ÜºÙ¤ò¸«¤ë BORDER=0 WIDTH=104 HEIGHT=19></a></td></tr>
-</table>
-</td></tr></table>")
+ "<li>
+<div class=\"listIcon\"><a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)\"><img src=\".*\" alt=\".*\" /></a>
+<span class=\"name\"><a href=\"view_diary\\.pl\\?id=[0-9]+&owner_id=[0-9]+\">\\(.*\\)</a></span></div>
+<div class=\"listContents\">
+<div class=\"heading\"><a href=\"view_diary\\.pl\\?id=[0-9]+&owner_id=[0-9]+\" class=\"name\">\\(.+\\)</a><span class=\"date\">\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</span></div>
+<p class=\"description\">\\(.*\\)
+</div>
+</li>")
 
 ;;;###autoload
 (defun mixi-search-diaries (keyword &optional range)
@@ -1354,29 +1443,29 @@ Increase this value when unexpected error frequently occurs."
        (year (nth 5 (decode-time (current-time))))
        (month (nth 4 (decode-time (current-time)))))
     (mapcar (lambda (item)
-               (let ((month-of-item (string-to-number (nth 3 item))))
+               (let ((month-of-item (string-to-number (nth 4 item))))
                  (when (> month-of-item month)
                    (decf year))
                  (setq month month-of-item)
-                 (mixi-make-diary (mixi-make-friend (nth 8 item) (nth 0 item))
-                                  (nth 7 item)
+                 (mixi-make-diary (mixi-make-friend (nth 1 item) (nth 2 item))
+                                  (nth 0 item)
                                   nil
                                   (encode-time
-                                   0 (string-to-number (nth 6 item))
+                                   0 (string-to-number (nth 7 item))
+                                   (string-to-number (nth 6 item))
                                    (string-to-number (nth 5 item))
-                                   (string-to-number (nth 4 item))
                                    month year)
-                                  (nth 1 item)
-                                  (nth 2 item))))
+                                  (nth 3 item)
+                                  (nth 8 item))))
            items)))
 
 (defmacro mixi-post-diary-page ()
   `(concat "/add_diary.pl"))
 
 (defconst mixi-post-key-regexp
-  "<input type=\"?hidden\"? name=\"?post_key\"? value=\"\\([a-z0-9]+\\)\">")
+  "<input type=\"?hidden\"? name=\"?post_key\"? +value=\"\\([a-z0-9]+\\)\"")
 (defconst mixi-post-succeed-regexp
-  "<b>\\(ºîÀ®\\|½ñ¤­¹þ¤ß\\)¤¬´°Î»¤·¤Þ¤·¤¿¡£È¿±Ç¤Ë»þ´Ö¤¬¤«¤«¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¾¯¡¹¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£</b>")
+  "<p\\(\\| class=\"messageAlert\"\\)>\\(ºîÀ®\\|½ñ¤­¹þ¤ß\\)¤¬´°Î»¤·¤Þ¤·¤¿¡£È¿±Ç¤Ë»þ´Ö¤¬¤«¤«¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£</p>")
 
 ;; FIXME: Support photos.
 ;;;###autoload
@@ -1398,7 +1487,8 @@ Increase this value when unexpected error frequently occurs."
     (setq fields `(("post_key" . ,post-key)
                   ("id" . ,(mixi-friend-id (mixi-make-me)))
                   ("diary_title" . ,title)
-                  ("diary_body" . ,content)
+                  ("diary_body" . ,(mixi-replace-tab-and-space-to-nbsp
+                                    content))
                   ("submit" . "confirm")))
     (with-mixi-post-form (mixi-post-diary-page) fields
       (unless (re-search-forward mixi-post-succeed-regexp nil t)
@@ -1434,71 +1524,78 @@ Increase this value when unexpected error frequently occurs."
 (defconst mixi-community-nodata-regexp
   "^¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó")
 (defconst mixi-community-name-regexp
-  "<td WIDTH=345>\\(.*\\)</td></tr>")
+  "<div class=\"pageTitle communityTitle002 communityTop\">
+<h2>\\(.*\\)</h2>")
 (defconst mixi-community-birthday-regexp
-  "<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>³«ÀßÆü</font></td>\r
-<td WIDTH=345>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü")
+  "<dt>³«ÀßÆü</dt>
+<dd>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br />")
 ;; FIXME: Care when the owner has seceded.
 (defconst mixi-community-owner-regexp
-  "<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>´ÉÍý¿Í</font></td>\r
-<td WIDTH=345>\r
-<table style=\"width: 100%;\"><tr><td>\r
+  "<dt>´ÉÍý¿Í</dt>
+<dd>
 <a href=\"\\(home\\.pl\\|show_friend\\.pl\\?id=\\([0-9]+\\)\\)\">\\(.*\\)</a>")
 (defconst mixi-community-category-regexp
-  "<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>¥«¥Æ¥´¥ê</font></td>\r
-<td WIDTH=345>\\([^<]+\\)</td>")
+  "<dt>¥«¥Æ¥´¥ê</dt>
+<dd>\\(.+\\)</dd>")
 (defconst mixi-community-members-regexp
-  "<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>¥á¥ó¥Ð¡¼¿ô</font></td>\r
-<td WIDTH=345>\\([0-9]+\\)¿Í</td></tr>")
+  "<dt>¥á¥ó¥Ð¡¼¿ô</dt>
+<dd>\\([0-9]+\\)¿Í</dd>")
 (defconst mixi-community-open-level-regexp
-  "<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>»²²Ã¾ò·ï¤È<br>¸ø³«¥ì¥Ù¥ë</font></td>\r
-<td WIDTH=345>\\(.+\\)</td></tr>")
+  "<dt>»²²Ã¾ò·ï¤È<br />¸ø³«¥ì¥Ù¥ë</dt>
+<dd>\\(.+\\)</dd>")
 (defconst mixi-community-authority-regexp
-  "<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>¥È¥Ô¥Ã¥¯ºîÀ®¤Î¸¢¸Â</font></td>\r
-<td WIDTH=345>\\(.+\\)</td></tr>")
+  "<dt>¥È¥Ô¥Ã¥¯¤Î<br />ºîÀ®¸¢¸Â</dt>
+<dd>
+\\(.+\\)
+
+
+</dd>")
 (defconst mixi-community-description-regexp
-  "<td CLASS=h120 WIDTH=345>\\(.+\\)</td>")
+  "<div id=\"communityIntro\">
+<p>\\(.+\\)</p>")
 
 (defun mixi-realize-community (community)
   "Realize a COMMUNITY."
-  ;; FIXME: Check a expiration of cache?
+  ;; FIXME: Check an expiration of cache?
   (unless (mixi-object-realized-p community)
     (with-mixi-retrieve (mixi-community-page community)
-      (if (re-search-forward mixi-community-nodata-regexp nil t)
-         ;; FIXME: Set all members?
-         (mixi-community-set-name community "¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó")
-       (if (re-search-forward mixi-community-name-regexp nil t)
-           (mixi-community-set-name community (match-string 1))
-         (mixi-realization-error 'cannot-find-name community))
-       (if (re-search-forward mixi-community-birthday-regexp nil t)
-           (mixi-community-set-birthday
-            community (encode-time 0 0 0 (string-to-number (match-string 3))
-                                   (string-to-number (match-string 2))
-                                   (string-to-number (match-string 1))))
-         (mixi-realization-error 'cannot-find-birthday community))
-       (if (re-search-forward mixi-community-owner-regexp nil t)
-           (if (string= (match-string 1) "home.pl")
-               (mixi-community-set-owner community (mixi-make-me))
-             (mixi-community-set-owner community
-                                       (mixi-make-friend (match-string 2)
-                                                         (match-string 3))))
-         (mixi-realization-error 'cannot-find-owner community))
-       (if (re-search-forward mixi-community-category-regexp nil t)
-           (mixi-community-set-category community (match-string 1))
-         (mixi-realization-error 'cannot-find-category community))
-       (if (re-search-forward mixi-community-members-regexp nil t)
-           (mixi-community-set-members community
-                                       (string-to-number (match-string 1)))
-         (mixi-realization-error 'cannot-find-members community))
-       (if (re-search-forward mixi-community-open-level-regexp nil t)
-           (mixi-community-set-open-level community (match-string 1))
-         (mixi-realization-error 'cannot-find-open-level community))
-       (if (re-search-forward mixi-community-authority-regexp nil t)
-           (mixi-community-set-authority community (match-string 1))
-         (mixi-realization-error 'cannot-find-authority community))
-       (if (re-search-forward mixi-community-description-regexp nil t)
-           (mixi-community-set-description community (match-string 1))
-         (mixi-realization-error 'cannot-find-description community))))
+      (let ((case-fold-search t))
+       (if (re-search-forward mixi-community-nodata-regexp nil t)
+           ;; FIXME: Set all members?
+           (mixi-community-set-name community "¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó")
+         (if (re-search-forward mixi-community-name-regexp nil t)
+             (mixi-community-set-name community (match-string 1))
+           (mixi-realization-error 'cannot-find-name community))
+         (if (re-search-forward mixi-community-birthday-regexp nil t)
+             (mixi-community-set-birthday
+              community (encode-time 0 0 0
+                                     (string-to-number (match-string 3))
+                                     (string-to-number (match-string 2))
+                                     (string-to-number (match-string 1))))
+           (mixi-realization-error 'cannot-find-birthday community))
+         (if (re-search-forward mixi-community-owner-regexp nil t)
+             (if (string= (match-string 1) "home.pl")
+                 (mixi-community-set-owner community (mixi-make-me))
+               (mixi-community-set-owner community (mixi-make-friend
+                                                    (match-string 2)
+                                                    (match-string 3))))
+           (mixi-realization-error 'cannot-find-owner community))
+         (if (re-search-forward mixi-community-category-regexp nil t)
+             (mixi-community-set-category community (match-string 1))
+           (mixi-realization-error 'cannot-find-category community))
+         (if (re-search-forward mixi-community-members-regexp nil t)
+             (mixi-community-set-members community
+                                         (string-to-number (match-string 1)))
+           (mixi-realization-error 'cannot-find-members community))
+         (if (re-search-forward mixi-community-open-level-regexp nil t)
+             (mixi-community-set-open-level community (match-string 1))
+           (mixi-realization-error 'cannot-find-open-level community))
+         (if (re-search-forward mixi-community-authority-regexp nil t)
+             (mixi-community-set-authority community (match-string 1))
+           (mixi-realization-error 'cannot-find-authority community))
+         (if (re-search-forward mixi-community-description-regexp nil t)
+             (mixi-community-set-description community (match-string 1))
+           (mixi-realization-error 'cannot-find-description community)))))
     (mixi-object-touch community)))
 
 (defun mixi-community-id (community)
@@ -1619,9 +1716,9 @@ Increase this value when unexpected error frequently occurs."
           (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
 
 (defconst mixi-community-list-id-regexp
-  "<a href=view_community\\.pl\\?id=\\([0-9]+\\)")
+  "<a href=\"?view_community\\.pl\\?id=\\([0-9]+\\)\"?")
 (defconst mixi-community-list-name-regexp
-  "<td valign=middle>\\(.+\\)([0-9]+)</td>")
+  "<span>\\(.+\\)([0-9]+)</span>")
 
 ;;;###autoload
 (defun mixi-get-communities (&rest friend-or-range)
@@ -1656,9 +1753,7 @@ Increase this value when unexpected error frequently occurs."
           "&category_id=0"))
 
 (defconst mixi-search-community-list-regexp
-  "<td WIDTH=90 VALIGN=top ROWSPAN=4 ALIGN=center background=http://img\\.mixi\\.jp/img/bg_line\\.gif><a href=\"view_community\\.pl\\?id=\\([0-9]+\\)\"><img SRC=\"http://img-c[0-9]+\\.mixi\\.jp/photo/comm/[^.]+\\.jpg\" VSPACE=3 border=0></a></td>
-<td NOWRAP WIDTH=90 BGCOLOR=#FDF9F2><font COLOR=#996600>¥³¥ß¥å¥Ë¥Æ¥£Ì¾</font></td>
-<td COLSPAN=2 WIDTH=370 BGCOLOR=#FFFFFF>\\([^<]+\\)</td></tr>")
+  "<dt class=\"communityTitle\"><a href=\"view_community\\.pl\\?id=\\([0-9]+\\)\">\\(.+\\) ([0-9]+)</a>")
 
 ;; FIXME: Support category.
 ;;;###autoload
@@ -1671,6 +1766,23 @@ Increase this value when unexpected error frequently occurs."
              (mixi-make-community (nth 0 item) (nth 1 item)))
            items)))
 
+;; Recommended community.
+(defalias 'mixi-recommended-community-list-page
+  'mixi-recommended-friend-list-page)
+
+(defconst mixi-recommended-community-list-regexp
+  "<div class=\"iconListImage\"><a href=\"http://mixi\\.jp/view_community\\.pl\\?id=\\([0-9]+\\)\" [^>]+>.+</a></div><span>\\(.+\\)([0-9]+)</span>")
+
+;;;###autoload
+(defun mixi-get-recommended-communities (&optional range)
+  "Get recommended communities."
+  (let ((items (mixi-get-matched-items (mixi-recommended-community-list-page)
+                                      mixi-recommended-community-list-regexp
+                                      range)))
+    (mapcar (lambda (item)
+             (mixi-make-community (nth 0 item) (nth 1 item)))
+           items)))
+
 ;; Topic object.
 (defvar mixi-topic-cache (make-hash-table :test 'equal))
 (defun mixi-make-topic (community id &optional comment-count time title owner
@@ -1700,25 +1812,29 @@ Increase this value when unexpected error frequently occurs."
           "&comm_id=" (mixi-community-id (mixi-topic-community ,topic))))
 
 (defconst mixi-topic-community-regexp
-  "<td width=\"595\" background=\"http://img\\.mixi\\.jp/img/bg_w\\.gif\"><b>\\[\\(.+\\)\\] ¥È¥Ô¥Ã¥¯</b></td>")
-(defconst mixi-topic-time-regexp
-  "<td rowspan=\"3\" width=\"110\" bgcolor=\"#ffd8b0\" align=\"center\" valign=\"top\" nowrap>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>\\([0-9]+\\):\\([0-9]+\\)</td>")
+  "<div class=\"pageTitle communityTitle002\">
+<h2>\\(.+\\) ¥È¥Ô¥Ã¥¯</h2>")
 (defconst mixi-topic-title-regexp
-  "<td bgcolor=\"#fff4e0\">&nbsp;\\([^<]+\\)</td>")
+  "<span class=\"title\">\\([^<]+\\)</span>")
+(defconst mixi-topic-time-regexp
+  "<span class=\"date\">\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</span>")
 (defconst mixi-topic-owner-regexp
-  "<td bgcolor=\"#fdf9f2\">&nbsp;<font color=\"#dfb479\"></font>&nbsp;<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*?\\)\\(¤µ¤ó\\)?</a>")
+  "<dt><a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*?\\)\\(¤µ¤ó\\)?</a>")
 (defconst mixi-topic-content-regexp
-  "<table width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"h120\"><table><tr>\\(<td width=\"130\" height=\"140\" align=\"center\" valign=\"middle\"><a href=\"javascript:void(0)\" onClick=\"MM_openBrWindow('show_bbs_picture\\.pl\\?id=[0-9]+&comm_id=[0-9]+&number=[0-9]+','pict','width=680,height=660,toolbar=no,scrollbars=yes,left=5,top=5')\"><img src=\"http://ic[0-9]+\\.mixi\\.jp/[^.]+\\.jpg\" border=\"0\"></a></td>\n\\)*</tr></table>\\(.+\\)</td></tr></table>")
+  "<dd>\\(\\(.\\|\r?\n\\)*?\\)</dd>")
 
 (defun mixi-realize-topic (topic &optional page)
   "Realize a TOPIC."
-  ;; FIXME: Check a expiration of cache?
+  ;; FIXME: Check an expiration of cache?
   (unless (mixi-object-realized-p topic)
     (with-mixi-retrieve (or page (mixi-topic-page topic))
       (if (re-search-forward mixi-topic-community-regexp nil t)
          (mixi-community-set-name (mixi-topic-community topic)
                                   (match-string 1))
        (mixi-realization-error 'cannot-find-community topic))
+      (if (re-search-forward mixi-topic-title-regexp nil t)
+         (mixi-topic-set-title topic (match-string 1))
+       (mixi-realization-error 'cannot-find-title topic))
       (if (re-search-forward mixi-topic-time-regexp nil t)
          (mixi-topic-set-time
           topic (encode-time 0 (string-to-number (match-string 5))
@@ -1727,15 +1843,12 @@ Increase this value when unexpected error frequently occurs."
                              (string-to-number (match-string 2))
                              (string-to-number (match-string 1))))
        (mixi-realization-error 'cannot-find-time topic))
-      (if (re-search-forward mixi-topic-title-regexp nil t)
-         (mixi-topic-set-title topic (match-string 1))
-       (mixi-realization-error 'cannot-find-title topic))
       (if (re-search-forward mixi-topic-owner-regexp nil t)
          (mixi-topic-set-owner topic (mixi-make-friend (match-string 1)
                                                        (match-string 2)))
        (mixi-realization-error 'cannot-find-owner topic))
       (if (re-search-forward mixi-topic-content-regexp nil t)
-         (mixi-topic-set-content topic (match-string 2))
+         (mixi-topic-set-content topic (match-string 1))
        (mixi-realization-error 'cannot-find-content topic)))
     (mixi-object-touch topic)))
 
@@ -1840,7 +1953,8 @@ Increase this value when unexpected error frequently occurs."
        (mixi-post-error 'cannot-find-key community)))
     (setq fields `(("post_key" . ,post-key)
                   ("bbs_title" . ,title)
-                  ("bbs_body" . ,content)
+                  ("bbs_body" . ,(mixi-replace-tab-and-space-to-nbsp
+                                  content))
                   ("submit" . "confirm")))
     (with-mixi-post-form (mixi-post-topic-page community) fields
       (unless (re-search-forward mixi-post-succeed-regexp nil t)
@@ -1876,87 +1990,77 @@ Increase this value when unexpected error frequently occurs."
           "&comm_id=" (mixi-community-id (mixi-event-community ,event))))
 
 (defconst mixi-event-community-regexp
-  "<td WIDTH=595 background=http://img\\.mixi\\.jp/img/bg_w\\.gif><b>\\[\\(.+\\)\\] ¥¤¥Ù¥ó¥È</b></td>")
-(defconst mixi-event-time-regexp
-  "<td ROWSPAN=11 \\(BGCOLOR\\|bgcolor\\)=#FFD8B0 \\(ALIGN\\|align\\)=center \\(VALIGN\\|Valign\\)=top WIDTH=110>
-?\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>
-?\\([0-9]+\\):\\([0-9]+\\)</td>")
+  "<div class=\"pageTitle communityTitle002\">
+<h2>\\(.+\\) ¥¤¥Ù¥ó¥È</h2>")
 (defconst mixi-event-title-regexp
-  "<td bgcolor=#FFF4E0\\( width=410\\)?>&nbsp;\\([^<]+\\)</td>")
-(defconst mixi-event-owner-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=#FDF9F2>&nbsp;<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>")
-(defconst mixi-event-owner-seceded-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=#FDF9F2>&nbsp;\\((mixi Âà²ñºÑ)\\)")
+  "<span class=\"title\">\\([^<]+\\)</span>")
+(defconst mixi-event-time-regexp
+  "<span class=\"date\">\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</span>")
 (defconst mixi-event-date-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\) \\(ALIGN\\|align\\)=center NOWRAP>³«ºÅÆü»þ</td>
-<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\)>
-&nbsp;\\(.+\\)
-</td>")
+  "<dt>³«ºÅÆü»þ</dt>
+<dd>\\(.+\\)</dd>")
 (defconst mixi-event-place-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\) \\(ALIGN\\|align\\)=center NOWRAP>³«ºÅ¾ì½ê</td>
-<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\)>
-&nbsp;\\(.+\\)
-</td>")
+  "<dt>³«ºÅ¾ì½ê</dt>
+<dd>\\(.+\\)</dd>")
+(defconst mixi-event-owner-regexp
+  "<dt>\\((mixi Âà²ñºÑ)\\|<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>\\)</dt>")
+(defconst mixi-event-owner-seceded-regexp
+  "(mixi Âà²ñºÑ)")
 (defconst mixi-event-detail-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\) \\(ALIGN\\|align\\)=center NOWRAP>¾ÜºÙ</td>
-<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\)><table BORDER=0 CELLSPACING=0 CELLPADDING=5><tr><td CLASS=h120>\\(.+\\)</td></tr></table></td>")
+  "<dd>\\(\\(.\\|\r?\n\\)*?\\)</dd>
+</dl>")
 (defconst mixi-event-limit-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=\"?#\\(FFFFFF\\|ffffff\\)\"? \\(ALIGN\\|align\\)=\"?center\"? NOWRAP>Ê罸´ü¸Â</td>
-?<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\)>&nbsp;\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü</td>")
+  "<dt>Ê罸´ü¸Â</dt>
+<dd>\\(.+\\)</dd>")
 (defconst mixi-event-members-regexp
-  "<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\) \\(ALIGN\\|align\\)=center NOWRAP>»²²Ã¼Ô</td>
-<td \\(BGCOLOR\\|bgcolor\\)=#\\(FFFFFF\\|ffffff\\)>
-
-?
-?<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%>
-<tr>
-
-?<td>&nbsp;\\(.+\\)</td>")
+  "<dt>»²²Ã¼Ô</dt>
+<dd>\\(.+\\)</dd>")
 
 (defun mixi-realize-event (event &optional page)
   "Realize a EVENT."
-  ;; FIXME: Check a expiration of cache?
+  ;; FIXME: Check an expiration of cache?
   (unless (mixi-object-realized-p event)
     (with-mixi-retrieve (or page (mixi-event-page event))
-      (if (re-search-forward mixi-event-community-regexp nil t)
-         (mixi-community-set-name (mixi-event-community event)
-                                  (match-string 1))
-       (mixi-realization-error 'cannot-find-community event))
-      (if (re-search-forward mixi-event-time-regexp nil t)
-         (mixi-event-set-time
-          event (encode-time 0 (string-to-number (match-string 8))
-                             (string-to-number (match-string 7))
-                             (string-to-number (match-string 6))
-                             (string-to-number (match-string 5))
-                             (string-to-number (match-string 4))))
-       (mixi-realization-error 'cannot-find-time event))
-      (if (re-search-forward mixi-event-title-regexp nil t)
-         (mixi-event-set-title event (match-string 2))
-       (mixi-realization-error 'cannot-find-title event))
-      (if (re-search-forward mixi-event-owner-regexp nil t)
-         (mixi-event-set-owner event (mixi-make-friend (match-string 2)
-                                                       (match-string 3)))
-       (if (re-search-forward mixi-event-owner-seceded-regexp nil t)
-           (mixi-event-set-owner event
-                                 (mixi-make-friend nil (match-string 2)))
-         (mixi-realization-error 'cannot-find-owner event)))
-      (if (re-search-forward mixi-event-date-regexp nil t)
-         (mixi-event-set-date event (match-string 6))
-       (mixi-realization-error 'cannot-find-date event))
-      (if (re-search-forward mixi-event-place-regexp nil t)
-         (mixi-event-set-place event (match-string 6))
-       (mixi-realization-error 'cannot-find-place event))
-      (if (re-search-forward mixi-event-detail-regexp nil t)
-         (mixi-event-set-detail event (match-string 6))
-       (mixi-realization-error 'cannot-find-detail event))
-      (when (re-search-forward mixi-event-limit-regexp nil t)
-       (mixi-event-set-limit
-        event (encode-time 0 0 0 (string-to-number (match-string 8))
-                           (string-to-number (match-string 7))
-                           (string-to-number (match-string 6)))))
-      (if (re-search-forward mixi-event-members-regexp nil t)
-         (mixi-event-set-members event (match-string 6))
-       (mixi-realization-error 'cannot-find-members event)))
+      (let ((case-fold-search t))
+       (if (re-search-forward mixi-event-community-regexp nil t)
+           (mixi-community-set-name (mixi-event-community event)
+                                    (match-string 1))
+         (mixi-realization-error 'cannot-find-community event))
+       (if (re-search-forward mixi-event-title-regexp nil t)
+           (mixi-event-set-title event (match-string 1))
+         (mixi-realization-error 'cannot-find-title event))
+       (if (re-search-forward mixi-event-time-regexp nil t)
+           (mixi-event-set-time
+            event (encode-time 0 (string-to-number (match-string 5))
+                               (string-to-number (match-string 4))
+                               (string-to-number (match-string 3))
+                               (string-to-number (match-string 2))
+                               (string-to-number (match-string 1))))
+         (mixi-realization-error 'cannot-find-time event))
+       (if (re-search-forward mixi-event-date-regexp nil t)
+           (mixi-event-set-date event (match-string 1))
+         (mixi-realization-error 'cannot-find-date event))
+       (if (re-search-forward mixi-event-place-regexp nil t)
+           (mixi-event-set-place event (match-string 1))
+         (mixi-realization-error 'cannot-find-place event))
+       (if (re-search-forward mixi-event-owner-regexp nil t)
+           (let ((seceded-or-not (match-string 1))
+                 (id (match-string 2))
+                 (nick (match-string 3)))
+             (if (string= mixi-event-owner-seceded-regexp seceded-or-not)
+                 (mixi-event-set-owner event
+                                       (mixi-make-friend nil seceded-or-not))
+               (mixi-event-set-owner event (mixi-make-friend id nick))))
+         (mixi-realization-error 'cannot-find-owner event))
+       (if (re-search-forward mixi-event-detail-regexp nil t)
+           (mixi-event-set-detail event (match-string 1))
+         (mixi-realization-error 'cannot-find-detail event))
+       (if (re-search-forward mixi-event-limit-regexp nil t)
+         (mixi-event-set-limit event (match-string 1))
+         (mixi-realization-error 'cannot-find-limit event))
+       (if (re-search-forward mixi-event-members-regexp nil t)
+           (mixi-event-set-members event (match-string 1))
+         (mixi-realization-error 'cannot-find-members event))))
     (mixi-object-touch event)))
 
 (defun mixi-event-community (event)
@@ -2130,11 +2234,11 @@ Increase this value when unexpected error frequently occurs."
           "&id=" (mixi-community-id ,community)))
 
 (defconst mixi-bbs-list-regexp
-  "<a href=view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)")
+  "<a href=\"?view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)")
 
 ;;;###autoload
 (defun mixi-get-bbses (community &optional range)
-  "Get bbese of COMMUNITY."
+  "Get bbses of COMMUNITY."
   (unless (mixi-community-p community)
     (signal 'wrong-type-argument (list 'mixi-community-p community)))
   (let ((items (mixi-get-matched-items (mixi-bbs-list-page community)
@@ -2152,7 +2256,7 @@ Increase this value when unexpected error frequently occurs."
   `(concat "/new_bbs.pl?page=%d"))
 
 (defconst mixi-new-bbs-list-regexp
-  "<a href=\"view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comment_count=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\" class=\"new_link\">")
+  "<dd><a href=\"view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comment_count=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\">")
 
 ;;;###autoload
 (defun mixi-get-new-bbses (&optional range)
@@ -2183,7 +2287,7 @@ Increase this value when unexpected error frequently occurs."
           "&community_id=0&category_id=0"))
 
 (defconst mixi-search-bbs-list-regexp
-  "<a href=\"view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\"><img src=http://img\\.mixi\\.jp/img/shbtn\\.gif ALT=¾ÜºÙ¤ò¸«¤ë BORDER=0 WIDTH=104 HEIGHT=19></a>")
+  "<a href=\"view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\" class=\"title\">")
 
 ;; FIXME: Support community and category.
 ;;;###autoload
@@ -2214,9 +2318,9 @@ Increase this value when unexpected error frequently occurs."
     (funcall func parent page)))
 
 ;; Comment object.
-(defun mixi-make-comment (parent owner time content)
+(defun mixi-make-comment (parent owner time content &optional count)
   "Return a comment object."
-  (cons 'mixi-comment (vector parent owner time content)))
+  (cons 'mixi-comment (vector parent owner time content count)))
 
 (defmacro mixi-comment-p (comment)
   `(eq (mixi-object-class ,comment) 'mixi-comment))
@@ -2245,6 +2349,12 @@ Increase this value when unexpected error frequently occurs."
     (signal 'wrong-type-argument (list 'mixi-comment-p comment)))
   (aref (cdr comment) 3))
 
+(defun mixi-comment-count (comment)
+  "Return the count of COMMENT."
+  (unless (mixi-comment-p comment)
+    (signal 'wrong-type-argument (list 'mixi-comment-p comment)))
+  (aref (cdr comment) 4))
+
 (defun mixi-diary-comment-list-page (diary)
   (concat "/view_diary.pl?full=1"
          "&id=" (mixi-diary-id diary)
@@ -2252,32 +2362,20 @@ Increase this value when unexpected error frequently occurs."
 
 ;; FIXME: Split regexp to time, owner(id and nick) and contents.
 (defconst mixi-diary-comment-list-regexp
-"<td rowspan=\"2\" align=\"center\" width=\"95\" bgcolor=\"#f2ddb7\" nowrap>
-\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>\\([0-9]+\\):\\([0-9]+\\)\\(<br>
-<input type=checkbox name=comment_id value=\".+\">
-\\|\\)
-</td>
-<td ALIGN=center BGCOLOR=#FDF9F2 WIDTH=430>
-<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"410\">
-<tr>
-\\(<td>\\)
-<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>
-
-\\(<font color=\"#f2ddb7\">|</font> <a href=[^>]+>ºï½ü</a>
-
-\\|\\)</td>
-</tr>
-</table>
-</td>
-</tr>
-<!-- [^ ]+ : start -->
-<tr>
-<td bgcolor=\"#ffffff\">
-<table BORDER=0 CELLSPACING=0 CELLPADDING=[35] WIDTH=410>
-<tr>
-<td CLASS=h12>
-\\(.+\\)
-</td></tr></table>")
+  "<span class=\"commentTitleName\">\\(<input type=\"checkbox\" name=\"comment_id\" value=\".+\" />
+\\|\\)<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>
+\\(
+| <a href=\"delete_comment\\.pl\\?diary_id=[0-9]+&owner_id=[0-9]+&comment_id=.+&type=comment\">¼«Ê¬¤Î¥³¥á¥ó¥È¤òºï½ü¤¹¤ë</a>
+\\|\\)</span>
+*
+<span class=\"commentTitleDate\">\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü&nbsp;\\([0-9]+\\):\\([0-9]+\\)</span>
+</dt>
+*
+<dd>
+\\(\\(.\\|\r?\n\\)*?\\)
+</dd>
+</dl>
+</div>")
 
 (defun mixi-topic-comment-list-page (topic)
   (concat "/view_bbs.pl?page=all"
@@ -2286,34 +2384,14 @@ Increase this value when unexpected error frequently occurs."
 
 ;; FIXME: Split regexp to time, owner(id and nick) and contents.
 (defconst mixi-topic-comment-list-regexp
-  "<tr valign=\"top\">
-<td rowspan=\"2\" width=\"110\" bgcolor=\"#f2ddb7\" align=\"center\" nowrap>
-\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>
-\\([0-9]+\\):\\([0-9]+\\)<br>
-\\(<input type=\"checkbox\" name=\"comment_id\" value=\".+\">
-\\|\\)</td>
-<td bgcolor=\"#fdf9f2\">&nbsp;<font color=\"#f8a448\">
-<b>[^<]+</b>:</font>&nbsp;
-\\(
-\\|\\) *<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>
-
-?\\(
-
-\\|<font color=\"#f2ddb7\">|&nbsp;</font><a href=\"delete_bbs_comment\\.pl\\?id=[0-9]+&comm_id=[0-9]+&comment_id=[0-9]+\">ºï½ü</a>
-\\|\\)</td>
-</tr>
-<tr>
-<td bgcolor=\"#ffffff\" align=\"center\">
-<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"500\">
-<tr>
-<td class=\"h120\">
-
-\\(.+\\)
-</td>
-</tr>
-</table>
-</td>
-</tr>")
+  "<dt class=\"commentDate clearfix\"><span class=\"senderId\">\\(<input id=\"commentCheck01\" name=\"comment_id\" type=\"checkbox\" value=\"[0-9]+\" /><label for=\"commentCheck01\">\\|\\)\\([0-9]+\\)\\(<span class=\"deleteTextArea\"><a href=\"delete_bbs_comment\\.pl\\?id=[0-9]+&comm_id=[0-9]+&comment_id=[0-9]+\">¼«Ê¬¤Î¥³¥á¥ó¥È¤òºï½ü¤¹¤ë</a></span>\\|</label>\\|\\)</span>
+<span class=\"date\">\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</span></dt>
+<dd>
+<dl class=\"commentContent01\">
+<dt><a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a></dt>
+<dd>
+\\(\\(.\\|\r?\n\\)*?\\)
+</dd>")
 
 (defun mixi-event-comment-list-page (event)
   (concat "/view_event.pl?page=all"
@@ -2322,27 +2400,14 @@ Increase this value when unexpected error frequently occurs."
 
 ;; FIXME: Split regexp to time, owner(id and nick) and contents.
 (defconst mixi-event-comment-list-regexp
-  "<tr>
-<td ROWSPAN=2 ALIGN=center BGCOLOR=#F2DDB7 WIDTH=110>
-\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>
-\\([0-9]+\\):\\([0-9]+\\)<br>
-\\(</td>\\)
-\\(<td BGCOLOR=#FDF9F2>\\)
-<font COLOR=#F8A448><b>[^<]+</b> :</font>
-<a HREF=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>
-
-\\(<font COLOR=#F2DDB7>|</font>
-<a href=\"delete_bbs_comment\\.pl\\?id=[0-9]+&comm_id=[0-9]+&comment_id=[0-9]+&type=event\">ºï½ü</a>
-
-\\|\\)</td>
-</tr>
-<tr>
-<td ALIGN=center BGCOLOR=#FFFFFF>
-<table BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=500>
-<tr><td CLASS=h120>\\(.+\\)</td></tr>
-</table>
-</td>
-</tr>")
+  "<dt class=\"commentDate clearfix\"><span class=\"senderId\">\\(<input id=\"commentCheck01\" name=\"comment_id\" type=\"checkbox\" value=\"[0-9]+\" /><label for=\"commentCheck01\">\\|\\)\\([0-9]+\\)\\(<span class=\"deleteTextArea\"><a href=\"delete_bbs_comment\\.pl\\?id=[0-9]+&comm_id=[0-9]+&comment_id=[0-9]+&type=event\">¼«Ê¬¤Î¥³¥á¥ó¥È¤òºï½ü¤¹¤ë</a></span>\\|</label>\\|\\)</span>
+<span class=\"date\">\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</span></dt>
+<dd>
+<dl class=\"commentContent01\">
+<dt><a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a></dt>
+<dd>
+\\(\\(.\\|\r?\n\\)*?\\)
+</dd>")
 
 ;;;###autoload
 (defun mixi-get-comments (parent &optional range)
@@ -2360,23 +2425,44 @@ Increase this value when unexpected error frequently occurs."
       (setq page nil))
     (let ((items (mixi-get-matched-items page regexp range t)))
       (mapcar (lambda (item)
-               (mixi-make-comment parent (mixi-make-friend
-                                          (nth 7 item) (nth 8 item))
-                                  (encode-time
-                                   0
-                                   (string-to-number (nth 4 item))
-                                   (string-to-number (nth 3 item))
-                                   (string-to-number (nth 2 item))
-                                   (string-to-number (nth 1 item))
-                                   (string-to-number (nth 0 item)))
-                                  (nth 10 item)))
+               (let (owner-id owner-nick year month day hour minute content
+                              count)
+                 (if (eq (mixi-object-class parent) 'mixi-diary)
+                     (progn
+                       (setq owner-id (nth 1 item))
+                       (setq owner-nick (nth 2 item))
+                       (setq year (nth 4 item))
+                       (setq month (nth 5 item))
+                       (setq day (nth 6 item))
+                       (setq hour (nth 7 item))
+                       (setq minute (nth 8 item))
+                       (setq content (nth 9 item)))
+                   (setq owner-id (nth 8 item))
+                   (setq owner-nick (nth 9 item))
+                   (setq year (nth 3 item))
+                   (setq month (nth 4 item))
+                   (setq day (nth 5 item))
+                   (setq hour (nth 6 item))
+                   (setq minute (nth 7 item))
+                   (setq content (nth 10 item))
+                   (setq count (nth 1 item)))
+                 (mixi-make-comment parent (mixi-make-friend owner-id
+                                                             owner-nick)
+                                    (encode-time
+                                     0
+                                     (string-to-number minute)
+                                     (string-to-number hour)
+                                     (string-to-number day)
+                                     (string-to-number month)
+                                     (string-to-number year))
+                                    content count)))
              items))))
 
 (defmacro mixi-new-comment-list-page ()
   `(concat "/new_comment.pl?page=%d"))
 
 (defconst mixi-new-comment-list-regexp
-  "<a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)&comment_count=\\([0-9]+\\)\" class=\"new_link\">")
+  "<a href=\"view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)&comment_count=\\([0-9]+\\)\">")
 
 ;;;###autoload
 (defun mixi-get-new-comments (&optional range)
@@ -2397,6 +2483,40 @@ Increase this value when unexpected error frequently occurs."
                        diary)))
                  items))))
 
+(defmacro mixi-new-bbs-comment-list-page ()
+  `(concat "/new_bbs_comment.pl?page=%d"))
+
+(defconst mixi-new-bbs-comment-list-regexp
+  "<a href=\"?view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comment_count=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\"?>")
+
+;;;###autoload
+(defun mixi-get-new-bbs-comments (&optional range)
+  "Get new BBS comments."
+  (let ((items (mixi-get-matched-items (mixi-new-bbs-comment-list-page)
+                                      mixi-new-bbs-comment-list-regexp
+                                      range)))
+    (delq nil
+         (mapcar (lambda (item)
+                   (let ((name (nth 0 item)))
+                     (when (string= name "bbs")
+                       (setq name "topic"))
+                     (let ((make-func (intern (concat "mixi-make-" name)))
+                           (comment-count-func
+                            (intern (concat "mixi-" name "-comment-count")))
+                           (set-comment-count-func
+                            (intern (concat "mixi-" name
+                                            "-set-comment-count"))))
+                       (let* ((bbs (funcall make-func
+                                    (mixi-make-community (nth 3 item))
+                                    (nth 1 item)))
+                              (comment-count (funcall comment-count-func bbs))
+                              (count (string-to-number (nth 2 item))))
+                         (when (or (null comment-count)
+                                   (< comment-count count))
+                           (funcall set-comment-count-func bbs count)
+                           bbs)))))
+                 items))))
+
 (defun mixi-post-diary-comment-page (diary)
   (concat "/add_comment.pl?&diary_id=" (mixi-diary-id diary)))
 
@@ -2433,17 +2553,20 @@ Increase this value when unexpected error frequently occurs."
        (setq fields
              `(("post_key" . ,post-key)
                ("owner_id" . ,(mixi-friend-id (mixi-diary-owner parent)))
-               ("comment_body" . ,content)
+               ("comment_body" . ,(mixi-replace-tab-and-space-to-nbsp
+                                   content))
                ("submit" . "confirm")))
       (setq fields `(("post_key" . ,post-key)
-                    ("comment" . ,content)
+                    ("comment" . ,(mixi-replace-tab-and-space-to-nbsp
+                                   content))
                     ("submit" . "confirm"))))
     (with-mixi-post-form (funcall page parent) fields
       (unless (re-search-forward mixi-post-succeed-regexp nil t)
        (mixi-post-error 'cannot-find-succeed parent)))))
 
 ;; Message object.
-(defconst mixi-message-box-list '(inbox outbox savebox thrash)) ; thrash?
+(defconst mixi-message-box-list
+  '(inbox outbox savebox thrash noticebox)) ; thrash?
 
 (defmacro mixi-message-box-p (box)
   `(memq ,box mixi-message-box-list))
@@ -2479,35 +2602,39 @@ Increase this value when unexpected error frequently occurs."
   `(concat "/view_message.pl?id=" (mixi-message-id ,message)
           "&box=" (mixi-message-box ,message)))
 
-(defconst mixi-message-owner-regexp
-  "<font COLOR=#996600>\\(º¹½Ð¿Í\\|°¸&nbsp;Àè\\)</font>&nbsp;:&nbsp;<a HREF=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)\\(</a>\\|</td>\\)")
-(defconst mixi-message-time-regexp
-"<font COLOR=#996600>Æü\\(¡¡\\|&nbsp;\\)ÉÕ</font>&nbsp;:&nbsp;\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\)»þ\\([0-9]+\\)ʬ&nbsp;&nbsp;")
 (defconst mixi-message-title-regexp
-"<font COLOR=#996600>·ï\\(¡¡\\|&nbsp;\\)̾</font>&nbsp;:&nbsp;\\(.*\\)\n?</td>")
+"<div class=\"messageDetailHead\">
+<h3>\\(.*\\)</h3>")
+(defconst mixi-message-time-regexp
+"<dt>ÆüÉÕ</dt>
+<dd>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\)»þ\\([0-9]+\\)ʬ</dd>")
+(defconst mixi-message-owner-regexp
+  "<dt>º¹½Ð¿Í</dt>
+<dd>\\(<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.*\\)</a>\\|mixi</dd>\\)")
 (defconst mixi-message-content-regexp
-  "<tr><td CLASS=h120>\\(.*\\)</td></tr>")
+"<div id=\"message_body\" class=\"messageDetailBody[^\"]*\">\\(\\(.\\|\r?\n\\)*?\\)</div>")
 
 (defun mixi-realize-message (message)
   "Realize a MESSAGE."
   (unless (mixi-object-realized-p message)
     (with-mixi-retrieve (mixi-message-page message)
-      (if (re-search-forward mixi-message-owner-regexp nil t)
-         (mixi-message-set-owner message
-                                 (mixi-make-friend (match-string 2)
-                                                   (match-string 3)))
-       (mixi-realization-error 'cannot-find-owner message))
+      (if (re-search-forward mixi-message-title-regexp nil t)
+         (mixi-message-set-title message (match-string 1))
+       (mixi-realization-error 'cannot-find-title message))
       (if (re-search-forward mixi-message-time-regexp nil t)
          (mixi-message-set-time
-          message (encode-time 0 (string-to-number (match-string 6))
-                               (string-to-number (match-string 5))
+          message (encode-time 0 (string-to-number (match-string 5))
                                (string-to-number (match-string 4))
                                (string-to-number (match-string 3))
-                               (string-to-number (match-string 2))))
+                               (string-to-number (match-string 2))
+                               (string-to-number (match-string 1))))
        (mixi-realization-error 'cannot-find-time message))
-      (if (re-search-forward mixi-message-title-regexp nil t)
-         (mixi-message-set-title message (match-string 2))
-       (mixi-realization-error 'cannot-find-title message))
+      (if (re-search-forward mixi-message-owner-regexp nil t)
+         (unless (string= (match-string 1) "mixi</dd>")
+           (mixi-message-set-owner message
+                                   (mixi-make-friend (match-string 2)
+                                                     (match-string 3))))
+       (mixi-realization-error 'cannot-find-owner message))
       (if (re-search-forward mixi-message-content-regexp nil t)
          (mixi-message-set-content message (match-string 1))
        (mixi-realization-error 'cannot-find-content message)))
@@ -2582,7 +2709,7 @@ Increase this value when unexpected error frequently occurs."
           (when ,box (concat "&box=" ,box))))
 
 (defconst mixi-message-list-regexp
-  "<td><a HREF=\"view_message\\.pl\\?id=\\(.+\\)&box=\\(.+\\)\">")
+  "<a href=\"view_message\\.pl\\?id=\\(.+\\)&box=\\([^&\"]+\\)")
 
 ;;;###autoload
 (defun mixi-get-messages (&rest box-or-range)
@@ -2605,14 +2732,16 @@ Increase this value when unexpected error frequently occurs."
                (mixi-make-message (nth 0 item) (nth 1 item)))
              items))))
 
-(defmacro mixi-post-message-page (friend)
-  `(concat "/send_message.pl?id=" (mixi-friend-id friend)))
+(defmacro mixi-post-message-page (&optional friend)
+  `(concat "/send_message.pl"
+          (when ,friend
+            (concat "?id=" (mixi-friend-id ,friend)))))
 
 (defconst mixi-post-message-key-regexp
-  "<input name=post_key type=hidden value=\\([a-z0-9]+\\)>")
+  "<input name=\"?post_key\"? type=\"?hidden\"? value=\"?\\([a-z0-9]+\\)\"? ")
 
 (defconst mixi-post-message-succeed-regexp
-  "<b>Á÷¿®´°Î»</b>¤·¤Þ¤·¤¿¡£")
+  "Á÷¿®¤¬´°Î»¤·¤Þ¤·¤¿¡£")
 
 ;;;###autoload
 (defun mixi-post-message (friend title content)
@@ -2631,12 +2760,16 @@ Increase this value when unexpected error frequently occurs."
       (if (re-search-forward mixi-post-message-key-regexp nil t)
          (setq post-key (match-string 1))
        (mixi-post-error 'cannot-find-key friend)))
-    (setq fields `(("post_key" . ,post-key)
+    (setq fields `(("from_show_friend" . "")
+                  ("mode" . "commit_or_edit")
                   ("subject" . ,title)
-                  ("body" . ,content)
-                  ("yes" . "¡¡Á÷¡¡¿®¡¡")
-                  ("submit" . "confirm")))
-    (with-mixi-post-form (mixi-post-message-page friend) fields
+                  ("body" . ,(mixi-replace-tab-and-space-to-nbsp content))
+                  ("post_key" . ,post-key)
+                  ("id" . ,(mixi-friend-id friend))
+                  ("original_message_id" . "")
+                  ("reply_message_id" . "")
+                  ("yes" . "Á÷¿®¤¹¤ë")))
+    (with-mixi-post-form (mixi-post-message-page) fields
       (unless (re-search-forward mixi-post-message-succeed-regexp nil t)
        (mixi-post-error 'cannot-find-succeed friend)))))
 
@@ -2746,13 +2879,13 @@ Increase this value when unexpected error frequently occurs."
                   mixi-news-cache))
 
 (defconst mixi-news-url-regexp
-  "/view_news\\.pl\\?id=\\([0-9]+\\)&media_id=\\([0-9]+\\)")
+  "/view_news\\.pl\\?\\(id=\\([0-9]+\\)&media_id=\\([0-9]+\\)\\|media_id=\\([0-9]+\\)&id=\\([0-9]+\\)\\)")
 
 (defun mixi-make-news-from-url (url)
   "Return a news object from URL."
   (when (string-match mixi-news-url-regexp url)
-    (let ((id (match-string 1 url))
-         (media-id (match-string 2 url)))
+    (let ((id (or (match-string 2 url) (match-string 5 url)))
+         (media-id (or (match-string 3 url) (match-string 4 url))))
       (mixi-make-news media-id id))))
 
 (defmacro mixi-news-p (news)
@@ -2762,27 +2895,22 @@ Increase this value when unexpected error frequently occurs."
   `(concat "http://news.mixi.jp/view_news.pl?id=" (mixi-news-id ,news)
           "&media_id=" (mixi-news-media-id ,news)))
 
-
 (defconst mixi-news-finished-regexp
-  "<td ALIGN=center background=http://img\\.mixi\\.jp/img/bg_line\\.gif> ¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¤³¤Î¥Ë¥å¡¼¥¹¤Ï·ÇºÜ½ªÎ»¤·¤Þ¤·¤¿¡£</td>")
+  "<p class=\"supplement01\">¢¨¿½¤·Ìõ¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¥Ë¥å¡¼¥¹¤Ï·ÇºÜ´ü´Ö¤¬½ªÎ»¤·¤¿¤«¡¢URL¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤¿¤á¤´Í÷¤¤¤¿¤À¤±¤Þ¤»¤ó¡£¾Ü¤·¤¯¤Ï<a href=\"http://mixi.jp/help.pl#16h\">¤³¤Á¤é</a>¤ò¤´Í÷¤¯¤À¤µ¤¤¡£</p>")
 (defconst mixi-news-title-regexp
-  "<td HEIGHT=\"46\" STYLE=\"font-weight: bold;font-size: 14px;\" CLASS=\"h130\">\\(.+\\)\\(\r
-\\)?</td>")
+  "<div class=\"articleH[ae][ae]ding\">
+<h2>\\(.+\\)</h2>")
 (defconst mixi-news-media-time-regexp
-  "<td COLSPAN=\"2\" ALIGN=\"right\">(\\(.+\\)&nbsp;-&nbsp;\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\))</td></tr>")
+  "<p class=\"date\">¡Ê\\(.+\\) - \\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)¡Ë</p>")
 (defconst mixi-news-content-regexp
-  "<td CLASS=\"h150\">
-
-\\(.+\\)
-<br>
-\\(.*
-\\)?
-
-\\(</td>\\|<br>\\)")
+  "<div class=\"article\">
+\\(\\(.\\|\r?\n\\)*?\\)
+\\(</div>
+</div>\\|<div class=\"additional\">\\)")
 
 (defun mixi-realize-news (news)
   "Realize a NEWS."
-  ;; FIXME: Check a expiration of cache?
+  ;; FIXME: Check an expiration of cache?
   (unless (mixi-object-realized-p news)
     (with-mixi-retrieve (mixi-news-page news)
       (if (re-search-forward mixi-news-finished-regexp nil t)
@@ -2877,7 +3005,8 @@ Increase this value when unexpected error frequently occurs."
   (aset (cdr news) 6 content))
 
 (defconst mixi-news-category-list '(domestic politics economy area abroad
-                                            sports entertainment IT))
+                                            sports entertainment IT game-anime
+                                            column))
 
 (defmacro mixi-news-category-p (category)
   `(memq ,category mixi-news-category-list))
@@ -2910,14 +3039,9 @@ Increase this value when unexpected error frequently occurs."
           "&type=bn"))
 
 (defconst mixi-news-list-regexp
-  "<tr bgcolor=\"\\(#FCF5EB\\|#FFFFFF\\)\">
-<td WIDTH=\"1%\" valign=top CLASS=\"h120\">¡¦</td>
-<td WIDTH=\"97%\" CLASS=\"h120\"><A HREF=\"view_news\\.pl\\?id=\\([0-9]+\\)&media_id=\\([0-9]+\\)\"class=\"new_link\">\\(.+\\)</A>
-\\(<IMG SRC=\"http://img\\.mixi\\.jp/img/news_camera3\\.gif\" WIDTH=\"11\" HEIGHT=\"12\">\\|\\)
-
-</td>
-<td WIDTH=\"1%\" nowrap CLASS=\"f08\"><A HREF=\"list_news_media\\.pl\\?id=[0-9]+\">\\(.+\\)</A></td>
-<td WIDTH=\"1%\" nowrap CLASS=\"f08\">\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</td></tr>")
+  "<td class=\"newsTitle\"><p>¡¦ <a href=\"view_news\\.pl\\?id=\\([0-9]+\\)&media_id=\\([0-9]+\\)\">\\(.+\\)</a><img src=\"http://img\\.mixi\\.jp/img/news_camera3\\.gif\" width=\"11\" height=\"12\" alt=\"\" /></p></td>
+<td class=\"media\"><a href=\"list_news_media\\.pl\\?id=[0-9]+\">\\(.+\\)</a></td>
+<td class=\"date\">\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</td>")
 
 ;;;###autoload
 (defun mixi-get-news (category sort &optional range)
@@ -2932,19 +3056,227 @@ Increase this value when unexpected error frequently occurs."
        (year (nth 5 (decode-time (current-time))))
        (month (nth 4 (decode-time (current-time)))))
     (mapcar (lambda (item)
-             (let ((month-of-item (string-to-number (nth 6 item))))
+             (let ((month-of-item (string-to-number (nth 4 item))))
                (when (> month-of-item month)
                  (decf year))
                (setq month month-of-item)
-               (mixi-make-news (nth 2 item) (nth 1 item) (nth 5 item)
+               (mixi-make-news (nth 1 item) (nth 0 item) (nth 3 item)
                                (encode-time
-                                0 (string-to-number (nth 9 item))
-                                (string-to-number (nth 8 item))
-                                (string-to-number (nth 7 item))
+                                0 (string-to-number (nth 7 item))
+                                (string-to-number (nth 6 item))
+                                (string-to-number (nth 5 item))
                                 month year)
-                               (nth 3 item))))
+                               (nth 2 item))))
+           items)))
+
+;; Release object.
+(defun mixi-make-release (title time content)
+  "Return a release object."
+  (cons 'mixi-release (vector title time content)))
+
+(defmacro mixi-release-p (release)
+  `(eq (mixi-object-class ,release) 'mixi-release))
+
+(defun mixi-release-title (release)
+  "Return the title of RELEASE."
+  (unless (mixi-release-p release)
+    (signal 'wrong-type-argument (list 'mixi-release-p release)))
+  (aref (cdr release) 0))
+
+(defun mixi-release-time (release)
+  "Return the time of RELEASE."
+  (unless (mixi-release-p release)
+    (signal 'wrong-type-argument (list 'mixi-release-p release)))
+  (aref (cdr release) 1))
+
+(defun mixi-release-content (release)
+  "Return the content of RELEASE."
+  (unless (mixi-release-p release)
+    (signal 'wrong-type-argument (list 'mixi-release-p release)))
+  (aref (cdr release) 2))
+
+(defmacro mixi-release-list-page ()
+  `(concat "/release_info.pl?page=%d"))
+
+(defconst mixi-release-list-regexp
+  "<td>&nbsp;<span STYLE=\"font-size:8pt;color:#DFB479\">¢£</span>&nbsp;<b><font COLOR=#605048>\\(.+\\)</font></b></td>
+<td ALIGN=right><font COLOR=#605048>\\([1-9][0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)</font></td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+
+<br>
+
+<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=450>
+<tr> 
+<td CLASS=h130>
+\\(.+\\)
+</td>
+</tr>
+</table>")
+
+;;;###autoload
+(defun mixi-get-releases (&optional range)
+  "Get releases."
+  (let ((items (mixi-get-matched-items (mixi-release-list-page)
+                                      mixi-release-list-regexp
+                                      range)))
+    (mapcar (lambda (item)
+             (mixi-make-release (nth 0 item)
+                                (encode-time 0 0 0
+                                             (string-to-number (nth 3 item))
+                                             (string-to-number (nth 2 item))
+                                             (string-to-number (nth 1 item)))
+                                (nth 4 item)))
            items)))
 
+;; Echo object.
+(defvar mixi-echo-cache (make-hash-table :test 'equal))
+;; FIXME: Support parent.
+(defun mixi-make-echo (owner post-time &optional content)
+  "Return an echo object."
+  (let ((owner (or owner (mixi-make-me))))
+    (mixi-make-cache (list (mixi-friend-id owner) post-time)
+                    (cons 'mixi-echo (vector nil owner post-time content))
+                    mixi-echo-cache)))
+
+(defconst mixi-echo-url-regexp
+  "view_echo\\.pl\\?id=\\([0-9]+\\)&post_time=\\([0-9]+\\)")
+
+(defun mixi-make-echo-from-url (url)
+  "Return an echo object from URL."
+  (when (string-match mixi-echo-url-regexp url)
+    (let ((owner-id (match-string 1 url))
+         (post-time (match-string 2 url)))
+      (mixi-make-echo (mixi-make-friend owner-id) post-time))))
+
+(defmacro mixi-echo-p (echo)
+  `(eq (mixi-object-class ,echo) 'mixi-echo))
+
+(defmacro mixi-echo-page (echo)
+  `(concat "/view_echo.pl?id=" (mixi-friend-id (mixi-echo-owner ,echo))
+          "&post_time=" (mixi-echo-post-time ,echo)))
+
+(defconst mixi-echo-owner-nick-regexp
+  "<div class=\"echo_nickname\" id=\"echo_nickname_[0-9]+\"  style=\"display: none;\">\\(.*\\)</div>")
+(defconst mixi-echo-content-regexp
+  "<div class=\"echo_body\" id=\"echo_body_[0-9]+\"      style=\"display: none;\">\\(.+\\)</div>")
+
+(defun mixi-realize-echo (echo)
+  "Realize an ECHO."
+  ;; FIXME: Check an expiration of cache?
+  (unless (mixi-object-realized-p echo)
+    (with-mixi-retrieve (mixi-echo-page echo)
+      (let ((case-fold-search t))
+       (if (re-search-forward mixi-echo-owner-nick-regexp nil t)
+           (mixi-friend-set-nick (mixi-echo-owner echo)
+                                 (match-string 1))
+         (mixi-realization-error 'cannot-find-owner-nick echo))
+       (if (re-search-forward mixi-echo-content-regexp nil t)
+           (mixi-echo-set-content echo (match-string 1))
+         (mixi-realization-error 'cannot-find-owner-nick echo))))
+    (mixi-object-touch echo)))
+
+(defun mixi-echo-owner (echo)
+  "Return the owner of ECHO."
+  (unless (mixi-echo-p echo)
+    (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+  (aref (cdr echo) 1))
+
+(defun mixi-echo-post-time (echo)
+  "Return the post-time of ECHO."
+  (unless (mixi-echo-p echo)
+    (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+  (aref (cdr echo) 2))
+
+(defun mixi-echo-content (echo)
+  "Return the content of ECHO."
+  (unless (mixi-echo-p echo)
+    (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+  (mixi-realize-echo echo)
+  (aref (cdr echo) 3))
+
+(defun mixi-echo-set-content (echo content)
+  "Set the content of ECHO."
+  (unless (mixi-echo-p echo)
+    (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+  (aset (cdr echo) 3 content))
+
+(defmacro mixi-echo-list-page (&optional friend)
+  `(concat "/list_echo.pl?page=%d"
+          (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
+
+(defconst mixi-echo-list-regexp
+  "<a href=\"view_echo\\.pl\\?id=\\([0-9]+\\)&post_time=\\([0-9]+\\)\">")
+
+;;;###autoload
+(defun mixi-get-echoes (&rest friend-or-range)
+  "Get echoes of FRIEND."
+  (when (> (length friend-or-range) 2)
+    (signal 'wrong-number-of-arguments
+           (list 'mixi-get-echoes (length friend-or-range))))
+  (let ((friend (nth 0 friend-or-range))
+       (range (nth 1 friend-or-range)))
+    (when (or (not (mixi-friend-p friend)) (mixi-friend-p range))
+      (setq friend (nth 1 friend-or-range))
+      (setq range (nth 0 friend-or-range)))
+    (unless (or (null friend) (mixi-friend-p friend))
+      (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
+    (let ((items (mixi-get-matched-items (mixi-echo-list-page friend)
+                                        mixi-echo-list-regexp
+                                        range)))
+      (mapcar (lambda (item)
+               (mixi-make-echo friend (nth 1 item)))
+             items))))
+
+(defmacro mixi-new-echo-list-page ()
+  `(concat "/recent_echo.pl?page=%d"))
+
+(defconst mixi-new-echo-list-regexp
+  "<a href=\"view_echo\\.pl\\?id=\\([0-9]+\\)&post_time=\\([0-9]+\\)\">")
+
+;;;###autoload
+(defun mixi-get-new-echoes (&optional range)
+  "Get new echoes."
+  (let ((items (mixi-get-matched-items (mixi-new-echo-list-page)
+                                      mixi-new-echo-list-regexp
+                                      range)))
+    (mapcar (lambda (item)
+             (mixi-make-echo (mixi-make-friend (nth 0 item)) (nth 1 item)))
+           items)))
+
+(defmacro mixi-post-echo-page ()
+  `(concat "/add_echo.pl"))
+
+(defconst mixi-echo-post-succeed-regexp mixi-my-id-regexp)
+
+;;;###autoload
+(defun mixi-post-echo (content &optional parent)
+  "Post an echo."
+  (unless (stringp content)
+    (signal 'wrong-type-argument (list 'stringp content)))
+  (unless (or (null parent) (mixi-echo-p parent))
+    (signal 'wrong-type-argument (list 'mixi-echo-p parent)))
+  (let (fields post-key)
+    (with-mixi-retrieve (format (mixi-new-echo-list-page) 1)
+      (if (re-search-forward mixi-post-key-regexp nil t)
+         (setq post-key (match-string 1))
+       (mixi-post-error 'cannot-find-key)))
+    (setq fields `(("post_key" . ,post-key)
+                  ("redirect" . "home")
+                  ("body" . ,content)))
+    (when (mixi-echo-p parent)
+      (setq fields (cons `("parent_member_id" . ,(mixi-friend-id
+                                                 (mixi-echo-owner parent)))
+                        fields))
+      (setq fields (cons `("parent_post_time" . ,(mixi-echo-post-time parent))
+                        fields)))
+    (with-mixi-post-form (mixi-post-echo-page) fields
+      (unless (re-search-forward mixi-echo-post-succeed-regexp nil t)
+       (mixi-post-error 'cannot-find-succeed)))))
+
 (provide 'mixi)
 
 ;;; mixi.el ends here