X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mixi.el;h=b0ee69ed2c67b8430c9ccd1d6637eb6e5f343c4f;hb=94409b948c5b2330fd4f19ed26d9423539044bb7;hp=cb8b2ed0abdae2707c3b6155491ca3e6dbdc5797;hpb=29738be226ea8350c050b5d21cf52e68a47b5968;p=elisp%2Fmixi.git diff --git a/mixi.el b/mixi.el index cb8b2ed..b0ee69e 100644 --- a/mixi.el +++ b/mixi.el @@ -29,11 +29,13 @@ ;; * mixi-get-friends ;; * mixi-get-favorites ;; * mixi-get-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 @@ -136,7 +138,7 @@ (autoload 'w3m-retrieve "w3m") (autoload 'url-retrieve-synchronously "url")) -(defconst mixi-revision "$Revision: 1.174 $") +(defconst mixi-revision "$Revision: 1.179 $") (defgroup mixi nil "API library for accessing to mixi." @@ -1147,6 +1149,23 @@ Increase this value when unexpected error frequently occurs." (string-to-number (nth 0 item))))) items))) +;; Recommended friend. +(defmacro mixi-recommended-friend-list-page () + `(concat "http://indies.mixi.jp/recommend.pl")) + +(defconst mixi-recommended-friend-list-regexp + "
]+>.+
\\(.+?\\)¤µ¤ó([0-9]+)") + +;;;###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-friend (nth 0 item) (nth 1 item))) + items))) + ;; Diary object. (defvar mixi-diary-cache (make-hash-table :test 'equal)) (defun mixi-make-diary (owner id &optional comment-count time title content) @@ -1459,7 +1478,7 @@ Increase this value when unexpected error frequently occurs." (defconst mixi-community-nodata-regexp "^¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó") (defconst mixi-community-name-regexp - "
+ "

\\(.*\\)

") (defconst mixi-community-birthday-regexp "
³«ÀßÆü
@@ -1701,6 +1720,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 + "\\(.+\\)([0-9]+)") + +;;;###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 @@ -2235,9 +2271,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)) @@ -2266,6 +2302,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) @@ -2281,8 +2323,6 @@ Increase this value when unexpected error frequently occurs." \\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\) - - +
\\(\\(.\\|\r?\n\\)*?\\) @@ -2297,7 +2337,8 @@ 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 - "\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\) + "
\\(\\|\\) +\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)
\\(.*\\)
@@ -2312,7 +2353,8 @@ 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 - "\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\) + "
\\(\\|\\) +\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)
\\(.*\\)
@@ -2336,7 +2378,8 @@ Increase this value when unexpected error frequently occurs." (setq page nil)) (let ((items (mixi-get-matched-items page regexp range t))) (mapcar (lambda (item) - (let (owner-id owner-nick year month day hour minute content) + (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)) @@ -2347,14 +2390,15 @@ Increase this value when unexpected error frequently occurs." (setq hour (nth 7 item)) (setq minute (nth 8 item)) (setq content (nth 9 item))) - (setq owner-id (nth 5 item)) - (setq owner-nick (nth 6 item)) - (setq year (nth 0 item)) - (setq month (nth 1 item)) - (setq day (nth 2 item)) - (setq hour (nth 3 item)) - (setq minute (nth 4 item)) - (setq content (nth 7 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 @@ -2364,7 +2408,7 @@ Increase this value when unexpected error frequently occurs." (string-to-number day) (string-to-number month) (string-to-number year)) - content))) + content count))) items)))) (defmacro mixi-new-comment-list-page () @@ -2905,7 +2949,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))