Hobbit / BigBrother の bb2.html を読むネタ。
http://subtech.g.hatena.ne.jp/miyagawa/20060611/1149963082 を読んで、CustomFeed を作らなくても何とかなりそうだったので。
# handle する手がかりが bb2.html という URL のみ、というのはちょっとアレ。だけど hobbit / bb 共通で使おうと思うと適当な要素が見つからず……
assets/plugins/Filter-EntryFullText/hobbit.yaml
# Hobbit / BigBrother , bb2.html author: FUJIWARA Shunichiro custom_feed_handle: bb2\.html$ custom_feed_follow_link: /bb-histlog\.sh handle: bb-histlog\.sh extract: <TITLE>(.*?) @ (.*?)</TITLE>.*?(<H3>.*?</H3>.*?<PRE>.*?</PRE>) extract_capture: title date body
- module: Subscription::Config config: feed: - url: http://demo.bb4.com/bb/bb2.html - module: Filter::EntryFullText
たぶんちゃんと読めている、と思う。
ただ、Hobbit/BB が吐き出す HTML はタグが大文字なので、以下のようにして、大文字小文字を同一視するようにしないと feed のタイトルが取得できない。
--- lib/Plagger/Util.pm (リビジョン 966) +++ lib/Plagger/Util.pm (作業コピー) @@ -95,7 +95,7 @@ sub extract_title { my $content = shift; - my $title = ($content =~ m!<title>\s*(.*?)\s*</title>!s)[0] or return; + my $title = ($content =~ m!<title>\s*(.*?)\s*</title>!is)[0] or return; HTML::Entities::decode($1); }