149 lines
14 KiB
Markdown
149 lines
14 KiB
Markdown
---
|
||
title: Gauche-net-twitter を使ってみる
|
||
author: kazu634
|
||
date: 2010-06-07
|
||
url: /2010/06/07/_1533/
|
||
wordtwit_post_info:
|
||
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:5273;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
|
||
categories:
|
||
- gauche
|
||
- Lisp
|
||
|
||
---
|
||
<div class="section">
|
||
<p>
|
||
shiroさんの仕事の速さに脱帽しつつ、とりあえず投稿するところまでやってみました。
|
||
</p>
|
||
|
||
<h4>
|
||
ダウンロード
|
||
</h4>
|
||
|
||
<p>
|
||
<a href="http://github.com/shirok/Gauche-net-twitter" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://github.com/shirok/Gauche-net-twitter', 'github');" target="_blank">github</a>からダウンロードします。
|
||
</p>
|
||
|
||
<p>
|
||
<a href="http://f.hatena.ne.jp/sirocco634/20100607221232" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://f.hatena.ne.jp/sirocco634/20100607221232', '');" class="hatena-fotolife" target="_blank"><img src="http://cdn-ak.f.st-hatena.com/images/fotolife/s/sirocco634/20100607/20100607221232.png" alt="f:id:sirocco634:20100607221232p:image" title="f:id:sirocco634:20100607221232p:image" class="hatena-fotolife" /></a>
|
||
</p>
|
||
|
||
<h4>
|
||
インストール
|
||
</h4>
|
||
|
||
<p>
|
||
こんな感じでインストールします:
|
||
</p>
|
||
|
||
<pre class="syntax-highlight">
|
||
kazu634@kazu634% tar <span class="synSpecial">-zxf</span> shirok-Gauche-net-twitter-403ef4f.tar.gz ~/Desktop <span class="synStatement">[</span><span class="synConstant">2649</span><span class="synStatement">]</span>
|
||
kazu634@kazu634% ll ~/Desktop <span class="synStatement">[</span><span class="synConstant">2650</span><span class="synStatement">]</span>
|
||
total <span class="synConstant">148312</span>
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">2</span>.0M <span class="synConstant">1</span> <span class="synConstant">31</span> <span class="synConstant">18</span>:<span class="synConstant">00</span> 02140_romanbath_1920x1200.jpg
|
||
drwxr-xr-x@ <span class="synConstant">10</span> kazu634 staff 340B <span class="synConstant">4</span> <span class="synConstant">16</span> <span class="synConstant">21</span>:<span class="synConstant">14</span> FusionChartsFree
|
||
drwxr-xr-x@ <span class="synConstant">12</span> kazu634 staff 408B <span class="synConstant">4</span> <span class="synConstant">16</span> <span class="synConstant">22</span>:<span class="synConstant">44</span> FusionChartsFree <span class="synConstant">2</span>
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>-- <span class="synConstant">1</span> kazu634 staff 705K <span class="synConstant">6</span> <span class="synConstant">6</span> <span class="synConstant">21</span>:<span class="synConstant">02</span> Monthly1006.pdf
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff 70M <span class="synConstant">5</span> <span class="synConstant">26</span> <span class="synConstant">22</span>:<span class="synConstant">12</span> galapagos.MP3
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff 140B <span class="synConstant">4</span> <span class="synConstant">13</span> <span class="synConstant">23</span>:<span class="synConstant">50</span> googlemaps.key.gpg
|
||
drwxr-xr-x@ <span class="synConstant">9</span> kazu634 staff 306B <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> shirok-Gauche-net-twitter-403ef4f
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff 10K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">21</span>:<span class="synConstant">43</span> shirok-Gauche-net-twitter-403ef4f.tar.gz
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">2</span>.1K <span class="synConstant">5</span> <span class="synConstant">22</span> <span class="synConstant">14</span>:<span class="synConstant">13</span> twitter_signature.png
|
||
kazu634@kazu634% <span class="synStatement">cd</span> shirok-Gauche-net-twitter-403ef4f/
|
||
kazu634@kazu634% ll ~/Desktop/shirok-Gauche-net-twitter-403ef4f <span class="synStatement">[</span><span class="synConstant">2652</span><span class="synStatement">]</span>
|
||
total <span class="synConstant">64</span>
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">1</span>.5K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> COPYING
|
||
-rwxr-xr-x@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">1</span>.0K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> DIST
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">1</span>.7K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> Makefile.<span class="synError">in</span>
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">8</span>.9K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> README
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff <span class="synConstant">2</span>.4K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> configure.ac
|
||
drwxr-xr-x@ <span class="synConstant">4</span> kazu634 staff 136B <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> net
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>--@ <span class="synConstant">1</span> kazu634 staff 138B <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> <span class="synStatement">test</span>.scm
|
||
kazu634@kazu634% ./DIST gen ~/Desktop/shirok-Gauche-net-twitter-403ef4f <span class="synStatement">[</span><span class="synConstant">2662</span><span class="synStatement">]</span>
|
||
kazu634@kazu634% ./configure ~/Desktop/shirok-Gauche-net-twitter-403ef4f <span class="synStatement">[</span><span class="synConstant">2663</span><span class="synStatement">]</span>
|
||
checking <span class="synStatement">for</span> gosh... /opt/<span class="synStatement">local</span>/bin/gosh
|
||
checking <span class="synStatement">for</span> gauche-config... /opt/<span class="synStatement">local</span>/bin/gauche-config
|
||
checking <span class="synStatement">for</span> gauche-package... /opt/<span class="synStatement">local</span>/bin/gauche-package
|
||
checking <span class="synStatement">for</span> gauche-<span class="synStatement">install</span>... /opt/<span class="synStatement">local</span>/bin/gauche-<span class="synStatement">install</span>
|
||
checking <span class="synStatement">for</span> gauche-cesconv... /opt/<span class="synStatement">local</span>/bin/gauche-cesconv
|
||
configure: creating Gauche-net-twitter.gpd
|
||
configure: creating ./config.<span class="synStatement">status</span>
|
||
config.<span class="synStatement">status</span>: creating Makefile
|
||
kazu634@kazu634% make ~/Desktop/shirok-Gauche-net-twitter-403ef4f <span class="synStatement">[</span><span class="synConstant">2664</span><span class="synStatement">]</span>
|
||
make: Nothing to be done <span class="synStatement">for</span> <span class="synSpecial">`all</span><span class="synStatement">'</span><span class="synConstant">.</span>
|
||
<span class="synConstant">kazu634@kazu634% make -s check ~/Desktop/shirok-Gauche-net-twitter-403ef4f [2665]</span>
|
||
<span class="synConstant">Testing net.twitter ... passed.</span>
|
||
<span class="synConstant">kazu634@kazu634% sudo make install ~/Desktop/shirok-Gauche-net-twitter-403ef4f [2666]</span>
|
||
<span class="synConstant">Password:</span>
|
||
<span class="synConstant">/opt/local/bin/gauche-install -C -m 444 -T /opt/local/lib/gauche/site/include </span>
|
||
<span class="synConstant">/opt/local/bin/gauche-install -C -m 444 -T /opt/local/share/gauche/site/lib ./net/twitter.scm ./net/twitauth.scm </span>
|
||
<span class="synConstant">/opt/local/bin/gauche-install -C -m 555 -T /opt/local/lib/gauche/site/0.9/i386-apple-darwin10.3.0 </span>
|
||
<span class="synConstant">/opt/local/bin/gauche-install -C -m 444 -T /opt/local/share/gauche/site/lib/.packages Gauche-net-twitter.gpd</span>
|
||
</pre>
|
||
|
||
<h4>
|
||
OAuthの認証プロセス
|
||
</h4>
|
||
|
||
<p>
|
||
手っ取り早く認証するためのスクリプトが用意されているので、それを利用します。
|
||
</p>
|
||
|
||
<pre class="syntax-highlight">
|
||
kazu634@kazu634% <span class="synStatement">cd</span> net/ ~/Desktop/shirok-Gauche-net-twitter-403ef4f <span class="synStatement">[</span><span class="synConstant">2668</span><span class="synStatement">]</span>
|
||
kazu634@kazu634% ll ~/Desktop/shirok-Gauche-net-twitter-403ef4f/net <span class="synStatement">[</span><span class="synConstant">2669</span><span class="synStatement">]</span>
|
||
total <span class="synConstant">40</span>
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>-- <span class="synConstant">1</span> kazu634 staff <span class="synConstant">1</span>.5K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> twitauth.scm
|
||
-rw-<span class="synStatement">r</span>--<span class="synStatement">r</span>-- <span class="synConstant">1</span> kazu634 staff 16K <span class="synConstant">6</span> <span class="synConstant">7</span> <span class="synConstant">18</span>:<span class="synConstant">27</span> twitter.scm
|
||
kazu634@kazu634% gosh twitauth.scm ~/Desktop/shirok-Gauche-net-twitter-403ef4f/net <span class="synStatement">[</span><span class="synConstant">2671</span><span class="synStatement">]</span>
|
||
Enter consumer key: 自分の consumer key
|
||
Enter consumer secret: 自分の consumer secret key
|
||
Open the following url and <span class="synStatement">type</span> <span class="synError">in</span> the shown PIN.
|
||
https://api.twitter.com/oauth/authorize?<span class="synIdentifier">oauth_token</span>=nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
|
||
Input PIN: <span class="synConstant">6828271</span>
|
||
<span class="synStatement">(</span>
|
||
<span class="synStatement">(</span>consumer-key <span class="synStatement"> . "</span><span class="synSpecial">自分の</span><span class="synConstant"> consumer key</span><span class="synStatement">")</span>
|
||
<span class="synStatement">(</span>consumer-secret <span class="synStatement"> . "</span><span class="synSpecial">自分の</span><span class="synConstant"> consumer secret key</span><span class="synStatement">")</span>
|
||
<span class="synStatement">(</span>access-token <span class="synStatement"> . "</span><span class="synConstant">access token</span><span class="synStatement">")</span>
|
||
<span class="synStatement">(</span>access-token-secret<span class="synStatement"> . "</span><span class="synConstant">access token secret</span><span class="synStatement">")</span>
|
||
<span class="synStatement">)</span>
|
||
</pre>
|
||
|
||
<p>
|
||
画面の指示に従いましょう。表示された consumer key, consumer secret key, access token, access secret token はメモっておきましょう。
|
||
</p>
|
||
|
||
<h4>
|
||
twitter に投稿してみる
|
||
</h4>
|
||
|
||
<p>
|
||
こうすると投稿できます:
|
||
</p>
|
||
|
||
<pre class="syntax-highlight">
|
||
<span class="synSpecial">(</span>use net.twitter<span class="synSpecial">)</span>
|
||
<span class="synSpecial">(</span>define cred
|
||
<span class="synSpecial">(</span>make <twitter-cred>
|
||
:consumer-key <span class="synConstant">"自分の consumer key"</span>
|
||
:consumer-secret <span class="synConstant">"自分の consumer secret key"</span>
|
||
:access-token <span class="synConstant">"access token"</span>
|
||
:access-token-secret <span class="synConstant">"access token secret"</span><span class="synSpecial">))</span>
|
||
<span class="synSpecial">(</span>twitter-update cred <span class="synConstant">"Gosh-net-twitterからテスト投稿です!"</span><span class="synSpecial">)</span>
|
||
</pre>
|
||
|
||
<h4>
|
||
できました
|
||
</h4>
|
||
|
||
<p>
|
||
<a href="http://f.hatena.ne.jp/sirocco634/20100607222107" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://f.hatena.ne.jp/sirocco634/20100607222107', '');" class="hatena-fotolife" target="_blank"><img src="http://cdn-ak.f.st-hatena.com/images/fotolife/s/sirocco634/20100607/20100607222107.png" alt="f:id:sirocco634:20100607222107p:image" title="f:id:sirocco634:20100607222107p:image" class="hatena-fotolife" /></a>
|
||
</p>
|
||
|
||
<h4>
|
||
追記
|
||
</h4>
|
||
|
||
<p>
|
||
この記事を書いている間にも、 readme を更新している shiro さんがすげぇ。この記事書く意味がほとんどなくなった。自分が読んでいたときには (make <twitter-cred> …) してインスタンス作る部分が書いてなかったんだよなぁ。
|
||
</p>
|
||
</div> |