Plaggerで札幌のニュースをTwitterに投稿するbot

Debian Etchで、aptitudeでPlaggerをインストール後、svnでユーザディレクトリにPlaggerを展開した状態。
参考:plagger - otsune FreeStyleWiki
参考:RSSをtwitterに - otsune's SnakeOil - subtech

$ wget http://search.cpan.org/src/CTHOM/Net-Twitter-1.06/lib/Net/Twitter.pm
$ sudo mv Twitter.pm /usr/local/share/perl/5.8.8/Net
$ wget http://search.cpan.org/src/PERIGRIN/JSON-Any-1.13/lib/JSON/Any.pm
$ sudo mv Any.pm /usr/share/perl5/JSON/
# cpan
cpan> install Bundle::XML

$ vi ~/SapporoNews.yaml

plugins:
- module: Subscription::Config
config:
feed:
- http://myrss.jp/rdf/xxxxxxxxxxx

- module: Filter::Rule
rule:
module: Deduped

- module: Filter::Rule
rule:
- module: RecentN
count: 1

- module: Publish::Twitter
config:
username: SapporoNews
password: PASSWORD

※myrssは、Google検索で札幌を検索したものを登録
$ cd ~/plagger/
$ ./plagger -c ~/SapporoNews.yaml
$ crontab -e

0 * * * * cd /home/USER/plagger; plagger -c /home/USER/SapporoNews.yaml > /dev/null


実行時に

JSON::XS::from_json has been renamed to decode_json, either downgrade to pre-2.0 versions of JSON::XS or rename the call at /usr/share/perl5/JSON/Any.pm line 368

というログだけ出るけど、とりあえずポストは出来ている。
あとはしばらく様子見。Plaggerは色々面白そうなので、時間を見てもう少し勉強したい。

***追記(07/12/18)
エラーは、JSON::XSのVersionが2.0.1であることに起因しているようなので、
http://search.cpan.org/src/MLEHMANN/JSON-XS-1.53/XS.pm
をダウンロードして、
/usr/local/lib/perl/5.8.8/JSON/XS.pm
と入替した。
また、RecentNのcountは1→10に変更。

このブログの人気の投稿

転職のお知らせ

40代の減量戦略 〜体重-14kg、体脂肪率-12%を実現した具体的な方法〜

45歳になりました