Nobiさんの「Apple's Eye」をPlaggerでRSS化
Nobiさんこと林信行さんがMicrosoftのサイトに連載されている「Apple's Eye」を、PlaggerでRSS化してみた。
Nobiさんの記事は、はてブに「林信行」というタグでブックマークされているので、そのフィードをRSSリーダで読ませていただいている。
しかし、Microsoftの「Apple's Eye」だけは何故かはてブにブックマークされてなく、おまけにMicrosoftのサイトにはフィードも存在しないので、ちょっと不便に感じていた。
「Apple's Eye」の最新記事はPerrmalinkが存在せず、ブックマークしても次の記事が投稿された時点でURLが変わってしまうのが、ブックマークされてない理由だと思う。
でも、やっぱりRSSリーダで読みたいよなぁ。
わざわざMicrosoftのサイトに行くの面倒だし。
そこで、Plaggerで次のようにフィルターを書いて、「Apple's Eye」の最近の記事をRSS化してみた。
- assets/plugins/Filter-EntryFullText/mactopia_japan_nobi.yaml
# Mactopia Japan : Apple's Eye
# http://www.microsoft.com/japan/mac/column/default.mspx
author: Koji Kawade
custom_feed_handle: http://www\.microsoft\.com/japan/mac/column/contents/contents\.mspx
custom_feed_follow_link: /japan/mac/column/(contents/(19\d|2\d\d|3\d\d)|default)\.mspx
handle: http://www\.microsoft\.com/japan/mac/column/(contents/\d\d\d|default)\.mspx
extract: <h2>(.*?)</h2>(.*?)\[(\d{4}.*?\d{1,2}.*?\d{1,2}).*?\].*?</p>(.*?)<a href="/japan/mac/column/contents/contents\.mspx">
extract_capture: title title2 date body
extract_after_hook: |
$data->{date} =~ s!<.*?>!!g;
$data->{date} =~ s! !!g;
$data->{title2} =~ s!<.*?>!!g;
$data->{title} .= " : " . $data->{title2} if $data->{title2};
$data->{title} =~ s!<.*?>!!g;
extract_date_format: %Y年%m月%d
config.yamlは次のように書いた。
global:
cache:
base: /path/plagger
assets_path: /path/plagger/cpan/usr/bin/assets
timezone: Asia/Tokyo
plugins:
- module: Subscription::Config
config:
feed:
- url: http://www.microsoft.com/japan/mac/column/contents/contents.mspx
- module: Filter::EntryFullText
- module: Publish::Feed
config:
format: RSS
dir: /path/plagger/feed/
filename: mactopia_nobi.rss
自宅のMac OS Xでcronを定期的に実行してRSSを生成しているのだが、自宅のMacは24時間立ち上げている訳ではないので、どなたか24時間稼働しているサーバで実行しRSSを公開していただけないでしょうか。
Comments