2009-10-26
CPAN で必要なモジュールをインストール
http://www.omakase.org/perl/perl_module.html
followers_timeline http://blog.bulkneets.net/misc/followers/ を使ってみようと思い立ったけれど色々とモジュールが必要だったので CPAN からインストール。
su perl -MCPAN -e shell cpan>install NET::Twitter など
実行すると
protected user: 0 public user: 0 []
と表示された。どゆこと?
よくわからないので xyzzy の twitter-mode を使うことにする。
twitter-mode for xyzzy 0.0.0.5-alpha
miranda-twitter だと Timeilne を追いかけられないようなので twitter-mode を使ってみる。
Timeline で表示する件数を変えられないんだろうか? config.l で (setq *summary-search-max* 50) としても変わらない。
update が動かないと思ったら junk-library が古かった。迂闊。
まだ意味の分からない処理がある。
http://watcher.moe-nifty.com/memo/2007/04/twitter_api.html
friends_timeline で取得できる件数を指定できるようにした。API の制約上 200 件まで。
~/.twitter にあるディレクトリは削除しておく。上記の変更により、既存のファイルと同名のディレクトリを作ろうとする場合があるため(はまった)
http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
$ git format-patch --stdout 31abdaef > patch
diff --git a/site-lisp/twitter/api-json.l b/site-lisp/twitter/api-json.l
index 1490201..6ed7f17 100644
--- a/site-lisp/twitter/api-json.l
+++ b/site-lisp/twitter/api-json.l
@@ -286,12 +286,12 @@
(format nil "user_timeline/~A.json" target)
"user_timeline.json")))
-(defun url-friends_timeline (&optional target)
+(defun url-friends_timeline (&optional target count)
(concat *api-url-root*
"statuses/"
(if target
- (format nil "friends_timeline/~A.json" target)
- "friends_timeline.json")))
+ (format nil "friends_timeline/~A.json?count=~A" target count)
+ (format nil "friends_timeline.json?count=~A" count))))
(defun url-replies_timeline ()
(concat *api-url-root*
"statuses/"
diff --git a/site-lisp/twitter/api-xml.l b/site-lisp/twitter/api-xml.l
index 84de85e..c783f0e 100644
--- a/site-lisp/twitter/api-xml.l
+++ b/site-lisp/twitter/api-xml.l
@@ -223,12 +223,12 @@
(format nil "user_timeline/~A.xml" target)
"user_timeline.xml")))
-(defun url-friends_timeline (&optional target)
+(defun url-friends_timeline (&optional target count)
(concat *api-url-root*
"statuses/"
(if target
- (format nil "friends_timeline/~A.xml" target)
- "friends_timeline.xml")))
+ (format nil "friends_timeline/~A.xml?count=~A" target count)
+ (format nil "friends_timeline.xml?count=~A" count))))
(defun url-replies_timeline ()
(concat *api-url-root*
diff --git a/site-lisp/twitter/api.l b/site-lisp/twitter/api.l
index ce39e22..7a8f21d 100644
--- a/site-lisp/twitter/api.l
+++ b/site-lisp/twitter/api.l
@@ -127,7 +127,7 @@
(junk::junk-http-add-header "X-Twitter-Client" *client-name* headers)
(junk::junk-http-add-header "X-Twitter-Client-Version" *client-version* headers)
(when *client-url*
- (junk::junk-http-add-header "X-Twitter-Client-Url" *client-url* headers))
+ (junk::junk-http-add-header "X-Twitter-Client-URL" *client-url* headers))
(when (and username password)
(junk::junk-http-add-header "Authorization"
(concat "Basic "
@@ -245,7 +245,7 @@
(fetch-statuses url tmpfile headers force)))
(defun statuses-friends_timeline (username password &optional force target)
- (let* ((url (url-friends_timeline target))
+ (let* ((url (url-friends_timeline target *summary-friends-timeline-count*))
(tmpfile (local-file url username))
(headers (create-request-headers username password)))
(fetch-statuses url tmpfile headers force)))
diff --git a/site-lisp/twitter/config.l.sample b/site-lisp/twitter/config.l.sample
index 2e63bd9..99b5dec 100644
--- a/site-lisp/twitter/config.l.sample
+++ b/site-lisp/twitter/config.l.sample
@@ -52,3 +52,5 @@
;(setq *summary-search-max* 20)
;; 検索時の言語指定
;(setq *search-lang* "ja")
+;; friends-timeline で取得する件数
+;(setq *summary-friends-timeline-count* 20)
diff --git a/site-lisp/twitter/summary.l b/site-lisp/twitter/summary.l
index 218c89e..d12f3cc 100644
--- a/site-lisp/twitter/summary.l
+++ b/site-lisp/twitter/summary.l
@@ -27,6 +27,8 @@
;(defvar *summary-search-history* nil)
;(defvar *summary-search-histroy-max* 10)
+(defvar *summary-friends-timeline-count* 20)
+
(defvar *summary-regexp-keyword-list*
(compile-regexp-keyword-list
'(
--
1.6.4.msysgit.0
