* mixi.el (mixi-search-community-list-page): New macro.
authorbg66 <bg66>
Mon, 11 Dec 2006 03:14:48 +0000 (03:14 +0000)
committerbg66 <bg66>
Mon, 11 Dec 2006 03:14:48 +0000 (03:14 +0000)
(mixi-search-community-list-regexp): New regexp.
(mixi-search-communities): New function.

ChangeLog
mixi.el

index 8d3fef1..ded4967 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-12-11  OHASHI Akira  <bg66@koka-in.org>
 
+       * mixi.el (mixi-search-community-list-page): New macro.
+       (mixi-search-community-list-regexp): New regexp.
+       (mixi-search-communities): New function.
+
+2006-12-11  OHASHI Akira  <bg66@koka-in.org>
+
        * mixi.el (mixi-cache-expires): Set the default value to nil.
 
 2006-12-08  OHASHI Akira  <bg66@koka-in.org>
diff --git a/mixi.el b/mixi.el
index 53ae4d5..c637213 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -33,6 +33,7 @@
 ;;  * mixi-get-new-diaries
 ;;  * mixi-search-diaries
 ;;  * mixi-get-communities
+;;  * mixi-search-communities
 ;;  * mixi-get-bbses
 ;;  * mixi-get-new-bbses
 ;;  * mixi-get-comments
@@ -1342,6 +1343,26 @@ Increase this value when unexpected error frequently occurs."
          (incf index))
        (reverse ret)))))
 
+(defmacro mixi-search-community-list-page (keyword)
+  `(concat "/search_community.pl?page=%d&&sort=date&type=com&submit=main"
+          "&keyword=" (mixi-url-encode-and-quote-percent-string keyword)
+          "&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>")
+
+;; FIXME: Support category.
+(defun mixi-search-communities (keyword &optional range)
+  (let ((items (mixi-get-matched-items (mixi-search-community-list-page
+                                       keyword)
+                                      mixi-search-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)