Plaggerを使ってStickam関連の口コミ、ブログを自動収集して表示する
koba206の開発WIKI » » Plaggerを使ってStickam関連の口コミ、ブログを自動収集して表示する
インストール Ubuntuの場合1. sudo vi /etc/apt/sources.list でファイルを編集
「deb http://debian.hansode.org ./」を追加して保存する
2. sudo apt-get update をしてから、sudo apt-get install libplagger-perl を入力
3. 途中で
「Install these packages without verification [y/N]? y」
と表示されるがここは y を入力する。
4. 最新のソースを取ってくるために、svn checkout http://svn.bulknews.net/repos/plagger/trunk/plagger を入力する
5. svnから取得したフォルダの中からassetsとlibのフォルダを/usr/local/plagger/内にコピーしてくる
設定ファイルを用意する
1. /usr/local/plagger/ 内で vi stickamPlanet.yaml を入力して下記設定を入れる
実装するglobal:
plugin_path:
- /usr/local/plagger/lib/Plagger/Plugin
assets_path: /usr/local/plagger/assets
timezone: Asia/Tokyo
log:
level: debug
plugins:
- module: Subscription::Planet
config:
keyword: Stickam スティッカム
lang: ja
- module: Bundle::Planet
config:
duration: 7 days
title: Stickam Planet
description: Everything Stickam from the Web
dir: /www/koba206.com/planet/stickam
url: http://www.koba206.com/planet/stickam
theme: sixapart-std
stylesheet: http://bulknews.typepad.com/blog/styles.css
1. このままの状態でPlaggerを走らせると、エラーが起きる
Segmentation fault というエラーを吐き出して止まってしまう。調べた結果これはBundle::Planetが原因。 Plugin/Bundle/Planet.pm 内のHTML::Tidyをコメントアウトすると問題なく動くようになる。
資料:http://www.simazaki.com/~izumi/blog/archives/2007_8_8_494.html
これを自動的に1日二回更新されるようにcrontabを使って走らせる#eval { require HTML::Tidy };
#unless ($@) {
# $context->load_plugin({
# module => 'Filter::HTMLTidy',
# });
#}
これで作成できたのが⇒http://www.koba206.com/planet/stickam/tkobayashi@koba206:~$ crontab -e
SHELL=/bin/sh
# m h dom mon dow command
0 0,12 * * * plagger -c stickamPlanet.yaml
Plaggerに関することなら、販売されたばっかりの↓がおススメ!